Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
eval.c File Reference
#include <assert.h>
#include <float.h>
#include <inttypes.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>
#include <msgpack.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/eval.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/channel.h"
#include "nvim/charset.h"
#include "nvim/context.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/edit.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/os/fileio.h"
#include "nvim/func_attr.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
#include "nvim/iconv.h"
#include "nvim/if_cscope.h"
#include "nvim/indent_c.h"
#include "nvim/indent.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/menu.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/keymap.h"
#include "nvim/map.h"
#include "nvim/file_search.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/popupmnu.h"
#include "nvim/profile.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/sha256.h"
#include "nvim/sign.h"
#include "nvim/spell.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/tag.h"
#include "nvim/ui.h"
#include "nvim/main.h"
#include "nvim/mouse.h"
#include "nvim/terminal.h"
#include "nvim/undo.h"
#include "nvim/version.h"
#include "nvim/window.h"
#include "nvim/eval/encode.h"
#include "nvim/eval/decode.h"
#include "nvim/os/os.h"
#include "nvim/event/libuv_process.h"
#include "nvim/os/pty_process.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/time.h"
#include "nvim/os/time.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/os/dl.h"
#include "nvim/os/input.h"
#include "nvim/event/loop.h"
#include "nvim/lib/kvec.h"
#include "nvim/lib/khash.h"
#include "nvim/lib/queue.h"
#include "nvim/lua/executor.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/executor.h"
#include "nvim/eval/gc.h"
#include "nvim/macros.h"

Data Structures

struct  lval_S
 
struct  scriptvar_T
 
struct  funccall_S
 Structure used by trans_function_name() More...
 
struct  funcdict_T
 
struct  forinfo_T
 
struct  vimvar
 
struct  timer_T
 
struct  fst
 Structure holding VimL function definition. More...
 
struct  GetListLineCookie
 
struct  sortinfo_T
 struct storing information about current sort More...
 

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_tv   vv_di.di_tv
 
#define vimvarht   vimvardict.dv_hashtab
 v: hashtab More...
 
#define FNE_INCL_BR   1 /* find_name_end(): include [] in name */
 
#define FNE_CHECK_START
 
#define ABORTING(func)   abort = abort || func
 
#define FLEN_FIXED   40
 
#define SP_NOMOVE   0x01
 don't move cursor More...
 
#define SP_REPEAT   0x02
 repeat to find outer pair More...
 
#define SP_RETCOUNT   0x04
 return matchcount More...
 
#define SP_SETPCMARK   0x08
 set previous context mark More...
 
#define SP_START   0x10
 accept match at start position More...
 
#define SP_SUBPAT   0x20
 return nr of matching sub-pattern More...
 
#define SP_END   0x40
 leave cursor at end of match More...
 
#define SP_COLUMN   0x80
 start at cursor column More...
 
#define ITEM_COMPARE_FAIL   999
 

Typedefs

typedef struct lval_S lval_T
 
typedef void(* FunPtr) (void)
 
typedef void(* VimLFunc) (typval_T *args, typval_T *rvar, FunPtr data)
 Prototype of C function that implements VimL function. More...
 
typedef struct fst VimLFuncDef
 Structure holding VimL function definition. More...
 

Enumerations

enum  SomeMatchType {
  kSomeMatch, kSomeMatchEnd, kSomeMatchList, kSomeMatchStr,
  kSomeMatchStrPos
}
 Describe data to return from find_some_match() More...
 
enum  TransFunctionNameFlags {
  TFN_INT = 1, TFN_QUIET = 2, TFN_NO_AUTOLOAD = 4, TFN_NO_DEREF = 8,
  TFN_READ_ONLY = 16
}
 trans_function_name() flags More...
 
enum  GetLvalFlags { GLV_QUIET = TFN_QUIET, GLV_NO_AUTOLOAD = TFN_NO_AUTOLOAD, GLV_READ_ONLY = TFN_READ_ONLY }
 get_lval() flags More...
 
enum  assert_type_T {
  ASSERT_EQUAL, ASSERT_NOTEQUAL, ASSERT_MATCH, ASSERT_NOTMATCH,
  ASSERT_INRANGE, ASSERT_OTHER
}
 Type of assert_* check being performed. More...
 
enum  DictListType { kDictListKeys, kDictListValues, kDictListItems }
 Type for dict_list function. More...
 
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)
 
static int if (expr->v_type==VAR_FUNC)
 
 if (s==NULL)
 
 if (eval1_emsg(&s, rettv, true)==FAIL)
 
 emsgf (_(e_invexpr2), s)
 
static 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)
 
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, bool safe)
 
varnumber_T call_func_retnr (char_u *func, int argc, typval_T *argv, int safe)
 
char * call_func_retstr (const char *const func, int argc, typval_T *argv, bool safe) FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
 
void * call_func_retlist (char_u *func, int argc, typval_T *argv, bool safe)
 
void * save_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)
 
 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 * eval_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)
 
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
 
char_uget_function_name (expand_T *xp, int idx)
 
char_uget_expr_name (expand_T *xp, int idx)
 
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 (!evaluate)
 
else if (error==ERROR_NONE)
 
 while (argv_clear > 0)
 
 xfree (tofree)
 
 xfree (name)
 
void assert_inrange (typval_T *argvars)
 
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)
 
 tv_copy (tv,&vimvars[VV_VAL].vv_tv)
 
 if (eval_expr_typval(expr, argv, 2,&rettv)==FAIL)
 
 if (map)
 
void get_user_input (const typval_T *const argvars, typval_T *const rettv, const bool inputdialog) FUNC_ATTR_NONNULL_ALL
 
void mapblock_fill_dict (dict_T *const dict, const mapblock_T *const mp, long buffer_value, bool compatible) FUNC_ATTR_NONNULL_ALL
 
long do_searchpair (char_u *spat, char_u *mpat, char_u *epat, int dir, const typval_T *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit)
 
 if (list_arg->v_type!=VAR_LIST)
 
else if (recursive!=0)
 
 if (action_arg->v_type==VAR_UNKNOWN)
 
else if (action_arg->v_type!=VAR_STRING)
 
 if ((*act== 'a'||*act== 'r'||*act== ' '||*act== 'f')&&act[1]==NUL)
 
 if (title_arg->v_type==VAR_UNKNOWN)
 
 if (set_errorlist(wp, l, action,(char_u *) title, d)==OK)
 
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
 
void timer_teardown (void)
 
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)
 
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)
 
void set_selfdict (typval_T *rettv, dict_T *selfdict)
 
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)
 
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_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)
 
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)
 
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 void * var_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 (scid_T scriptID)
 
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)
 
typval_T eval_call_provider (char *provider, char *method, list_T *arguments)
 
bool eval_has_provider (const char *name)
 Checks if a named provider 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...
 

Variables

hashtab_T func_hashtab
 
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
 
static 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__
 
static void const char * title = NULL
 
int action = ' '
 
rettv vval v_number = -1
 
dict_Td = NULL
 
typval_Tlist_arg = &args[0]
 
typval_Taction_arg = &args[1]
 
const char *const act = tv_get_string_chk(action_arg)
 
 return
 
typval_Ttitle_arg = &args[2]
 
skip_args __pad1__
 
list_T *const l = list_arg->vval.v_list
 
 recurse
 
void linenr_T save_sourcing_lnum
 
scid_T save_current_SID = current_SID
 
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
 
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
 
 current_SID = fp->uf_script_ID
 
 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 FNE_CHECK_START
Value:
2 /* find_name_end(): check name starts with
valid character */
#define FNE_INCL_BR   1 /* find_name_end(): include [] in name */
#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 ITEM_COMPARE_FAIL   999
#define SCRIPT_SV (   id)    (((scriptvar_T **)ga_scripts.ga_data)[(id) - 1])
#define SCRIPT_VARS (   id)    (SCRIPT_SV(id)->sv_dict.dv_hashtab)
#define SP_COLUMN   0x80

start at cursor column

#define SP_END   0x40

leave cursor at end of match

#define SP_NOMOVE   0x01

don't move cursor

#define SP_REPEAT   0x02

repeat to find outer pair

#define SP_RETCOUNT   0x04

return matchcount

#define SP_SETPCMARK   0x08

set previous context mark

#define SP_START   0x10

accept match at start position

#define SP_SUBPAT   0x20

return nr of matching sub-pattern

#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:1968
err type
Definition: helpers.c:1421
#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_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

Typedef Documentation

typedef void(* FunPtr) (void)
typedef struct lval_S lval_T
typedef void(* VimLFunc) (typval_T *args, typval_T *rvar, FunPtr data)

Prototype of C function that implements VimL function.

typedef struct fst VimLFuncDef

Structure holding VimL function definition.

Enumeration Type Documentation

Type of assert_* check being performed.

Enumerator
ASSERT_EQUAL 
ASSERT_NOTEQUAL 
ASSERT_MATCH 
ASSERT_NOTMATCH 
ASSERT_INRANGE 
ASSERT_OTHER 

Type for dict_list function.

Enumerator
kDictListKeys 

List dictionary keys.

kDictListValues 

List dictionary values.

kDictListItems 

List dictionary contents: [keys, values].

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 

get_lval() flags

Enumerator
GLV_QUIET 

Do not emit error messages.

GLV_NO_AUTOLOAD 

Do not use script autoloading.

GLV_READ_ONLY 

Indicates that caller will not change the value (prevents error message).

Describe data to return from find_some_match()

Enumerator
kSomeMatch 

Data for match().

kSomeMatchEnd 

Data for matchend().

kSomeMatchList 

Data for matchlist().

kSomeMatchStr 

Data for matchstr().

kSomeMatchStrPos 

Data for matchstrpos().

trans_function_name() flags

Enumerator
TFN_INT 

May use internal function name.

TFN_QUIET 

Do not emit error messages.

TFN_NO_AUTOLOAD 

Do not use script autoloading.

TFN_NO_DEREF 

Do not dereference a Funcref.

TFN_READ_ONLY 

Will not change the variable.

Function Documentation

void assert_inrange ( typval_T argvars)
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 ( char_u func,
int  argc,
typval_T argv,
bool  safe 
)

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.
[in]safeUse the sandbox.
Returns
[allocated] NULL when calling function fails or return tv is not a List, allocated List otherwise.
varnumber_T call_func_retnr ( char_u func,
int  argc,
typval_T argv,
int  safe 
)

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.
[in]safeUse with sandbox.
Returns
-1 when calling function fails, result of function otherwise.
char* call_func_retstr ( const char *const  func,
int  argc,
typval_T argv,
bool  safe 
)

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.
[in]safeUse the sandbox.
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  safe 
)
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  )
int current_func_returned ( void  )
void del_menutrans_vars ( void  )
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 
)
long do_searchpair ( char_u spat,
char_u mpat,
char_u epat,
int  dir,
const typval_T skip,
int  flags,
pos_T match_pos,
linenr_T  lnum_stop,
long  time_limit 
)
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 
)
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 
)
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 *  name)

Checks if a named provider 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
hashitem_T* find_hi_in_scoped_ht ( const char *  name,
hashtab_T **  pht 
)

Search hashitem in parent scope.

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_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.

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 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.
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_expr_name ( expand_T xp,
int  idx 
)
char_u* get_func_line ( int  c,
void *  cookie,
int  indent 
)
char_u* get_function_name ( expand_T xp,
int  idx 
)
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.
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 
)
char_u* get_user_var_name ( expand_T xp,
int  idx 
)
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)
if ( ret  = FAIL)
else if ( expr->  v_type = VAR_FUNC)
if ( s  = NULL)
if ( eval1_emsg &,,  true = FAIL)
static 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 ( evaluate)
if ( error  = ERROR_NONE)
if ( eval_expr_typval(expr, argv, 2,&rettv = FAIL)
if ( map  )
if ( list_arg->v_type!  = VAR_LIST)
else if ( recursive!  = 0)
if ( action_arg->  v_type = VAR_UNKNOWN)
else if ( action_arg->v_type!  = VAR_STRING)
if ( *== ''||*== ''||*== ' '||*== ''f &&  act[1] = NUL)
else if ( title_arg->  v_type = VAR_UNKNOWN)
if ( set_errorlist(wp, l, action,(char_u *) title, d = OK)
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 last_set_msg ( scid_T  scriptID)
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
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 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* save_funccal ( void  )
save_search_patterns ( )
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_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.
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_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
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_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 ( )
xfree ( tofree  )
xfree ( name  )
xfree ( sourcing_name  )

Variable Documentation

theend __pad0__
skip_args __pad1__
const char* const act = tv_get_string_chk(action_arg)
int action = ' '
typval_T* action_arg = &args[1]
int ai
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:23440
if arg
Definition: eval.c:1961
#define EMSG(s)
Definition: message.h:39
return arg_end
int argcount = argcount_in
static int typval_T argv
Initial value:
{
Structure that holds an internal variable value.
Definition: typval.h:125
tv_clear & rettv
Definition: eval.c:1061
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
current_funccal = NULL
current_SID = fp->uf_script_ID
dict_T* d = 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]
Definition: vim.h:27
char *const buf
Definition: encode.c:231
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:126
Definition: eval.h:127
Definition: eval.h:131
return NULL
Definition: eval.c:23440
Definition: eval.h:125
Definition: eval.h:128
Definition: eval.h:124
Definition: eval.h:123
Definition: eval.h:130
Definition: eval.h:129

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:23440
return arg_end
Definition: eval.c:2116
unsigned char char_u
Definition: types.h:11
hashtab_T func_hashtab
bool func_not_yet_profiling_but_should
Initial value:
=
return NULL
Definition: eval.c:23440
bool has_profiling(bool file, char_u *fname, bool *fp)
Definition: ex_cmds2.c:775
ufunc_T * fp
Definition: eval.c:6427
int uf_profiling
true when func is being profiled
Definition: typval.h:262
char_u uf_name[]
Definition: typval.h:282
const bool do_profiling_yes
Definition: eval.c:22782
bool func_or_func_caller_profiling
Initial value:
=
return NULL
Definition: eval.c:23440
ufunc_T * func
Function being called.
Definition: eval.c:269
ufunc_T * fp
Definition: eval.c:6427
int uf_profiling
true when func is being profiled
Definition: typval.h:262
funccall_T * caller
Calling function or NULL.
Definition: eval.c:285
const bool do_profiling_yes
Definition: eval.c:22782
funccall_T * fc
Definition: eval.c:22556
const void const hashitem_T* hifirst = globvarht.ht_array
const size_t hinum = (size_t) globvarht.ht_mask + 1
hashtab_T* ht
bool islambda = false
size_t len = get_env_len((const char_u **)&arg)
fc level = ex_nesting_level
fc linenr = 0
typval_T* list_arg = &args[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:2169
char * name
Definition: eval.c:1968
unsigned char char_u
Definition: types.h:11
char_u * expr_start
Definition: eval.c:2168
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
return
fc returned = FALSE
return retval = FAIL
save_current_SID = current_SID
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:22712
save_sourcing_name = sourcing_name
dict_T* selfdict = selfdict_in
sourcing_lnum = 1
sourcing_name = xmalloc(len)
int started_profiling = false
void const char* title = NULL
typval_T* title_arg = &args[2]
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)
return NULL
Definition: eval.c:23440
Do not use script autoloading.
Definition: eval.c:243
hashtab_T * ht
Definition: eval.c:2154
Definition: eval.c:244
v di_tv vval v_list = &fc->l_varlist
v di_tv v_lock = VAR_FIXED
rettv vval v_number = -1
v di_tv v_type = VAR_UNKNOWN
tv_clear & var1
Initial value:
{
Definition: coverity-model.c:39
v
Definition: eval.c:2210
typval_T var2
proftime_T wait_start