0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1933: the eval.c file is too big

Problem:    The eval.c file is too big.
Solution:   Move code related to variables to evalvars.c. (Yegappan
            Lakshmanan, closes #4868)
This commit is contained in:
Bram Moolenaar
2019-08-27 22:48:30 +02:00
parent d20070274c
commit 0522ba0359
16 changed files with 2059 additions and 2014 deletions

View File

@@ -35,6 +35,7 @@ SRC_ALL = \
src/edit.c \ src/edit.c \
src/eval.c \ src/eval.c \
src/evalfunc.c \ src/evalfunc.c \
src/evalvars.c \
src/ex_cmdidxs.h \ src/ex_cmdidxs.h \
src/ex_cmds.c \ src/ex_cmds.c \
src/ex_cmds.h \ src/ex_cmds.h \
@@ -188,6 +189,7 @@ SRC_ALL = \
src/proto/edit.pro \ src/proto/edit.pro \
src/proto/eval.pro \ src/proto/eval.pro \
src/proto/evalfunc.pro \ src/proto/evalfunc.pro \
src/proto/evalvars.pro \
src/proto/ex_cmds.pro \ src/proto/ex_cmds.pro \
src/proto/ex_cmds2.pro \ src/proto/ex_cmds2.pro \
src/proto/ex_docmd.pro \ src/proto/ex_docmd.pro \

View File

@@ -722,6 +722,7 @@ OBJ = \
$(OUTDIR)/edit.o \ $(OUTDIR)/edit.o \
$(OUTDIR)/eval.o \ $(OUTDIR)/eval.o \
$(OUTDIR)/evalfunc.o \ $(OUTDIR)/evalfunc.o \
$(OUTDIR)/evalvars.o \
$(OUTDIR)/ex_cmds.o \ $(OUTDIR)/ex_cmds.o \
$(OUTDIR)/ex_cmds2.o \ $(OUTDIR)/ex_cmds2.o \
$(OUTDIR)/ex_docmd.o \ $(OUTDIR)/ex_docmd.o \

View File

@@ -42,6 +42,7 @@ SRC = arabic.c \
edit.c \ edit.c \
eval.c \ eval.c \
evalfunc.c \ evalfunc.c \
evalvars.c \
ex_cmds.c \ ex_cmds.c \
ex_cmds2.c \ ex_cmds2.c \
ex_docmd.c \ ex_docmd.c \

View File

@@ -731,6 +731,7 @@ OBJ = \
$(OUTDIR)\edit.obj \ $(OUTDIR)\edit.obj \
$(OUTDIR)\eval.obj \ $(OUTDIR)\eval.obj \
$(OUTDIR)\evalfunc.obj \ $(OUTDIR)\evalfunc.obj \
$(OUTDIR)\evalvars.obj \
$(OUTDIR)\ex_cmds.obj \ $(OUTDIR)\ex_cmds.obj \
$(OUTDIR)\ex_cmds2.obj \ $(OUTDIR)\ex_cmds2.obj \
$(OUTDIR)\ex_docmd.obj \ $(OUTDIR)\ex_docmd.obj \
@@ -1486,6 +1487,8 @@ $(OUTDIR)/eval.obj: $(OUTDIR) eval.c $(INCL)
$(OUTDIR)/evalfunc.obj: $(OUTDIR) evalfunc.c $(INCL) $(OUTDIR)/evalfunc.obj: $(OUTDIR) evalfunc.c $(INCL)
$(OUTDIR)/evalvars.obj: $(OUTDIR) evalvars.c $(INCL)
$(OUTDIR)/ex_cmds.obj: $(OUTDIR) ex_cmds.c $(INCL) $(OUTDIR)/ex_cmds.obj: $(OUTDIR) ex_cmds.c $(INCL)
$(OUTDIR)/ex_cmds2.obj: $(OUTDIR) ex_cmds2.c $(INCL) $(OUTDIR)/ex_cmds2.obj: $(OUTDIR) ex_cmds2.c $(INCL)
@@ -1771,6 +1774,7 @@ proto.h: \
proto/edit.pro \ proto/edit.pro \
proto/eval.pro \ proto/eval.pro \
proto/evalfunc.pro \ proto/evalfunc.pro \
proto/evalvars.pro \
proto/ex_cmds.pro \ proto/ex_cmds.pro \
proto/ex_cmds2.pro \ proto/ex_cmds2.pro \
proto/ex_docmd.pro \ proto/ex_docmd.pro \

View File

@@ -309,7 +309,8 @@ ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \
SRC = arabic.c arglist.c autocmd.c beval.c blob.c blowfish.c buffer.c \ SRC = arabic.c arglist.c autocmd.c beval.c blob.c blowfish.c buffer.c \
change.c charset.c cmdexpand.c cmdhist.c crypt.c crypt_zip.c \ change.c charset.c cmdexpand.c cmdhist.c crypt.c crypt_zip.c \
debugger.c dict.c diff.c digraph.c edit.c eval.c evalfunc.c ex_cmds.c \ debugger.c dict.c diff.c digraph.c edit.c eval.c evalfunc.c \
evalvars.c ex_cmds.c \
ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c if_cscope.c if_xcmdsrv.c \ ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c if_cscope.c if_xcmdsrv.c \
fileio.c findfile.c fold.c getchar.c hardcopy.c hashtab.c highlight.c \ fileio.c findfile.c fold.c getchar.c hardcopy.c hashtab.c highlight.c \
indent.c insexpand.c json.c list.c main.c map.c mark.c menu.c mbyte.c \ indent.c insexpand.c json.c list.c main.c map.c mark.c menu.c mbyte.c \
@@ -326,7 +327,8 @@ SRC = arabic.c arglist.c autocmd.c beval.c blob.c blowfish.c buffer.c \
OBJ = arabic.obj arglist.obj autocmd.obj beval.obj blob.obj blowfish.obj \ OBJ = arabic.obj arglist.obj autocmd.obj beval.obj blob.obj blowfish.obj \
buffer.obj change.obj charset.obj cmdexpand.obj cmdhist.obj \ buffer.obj change.obj charset.obj cmdexpand.obj cmdhist.obj \
crypt.obj crypt_zip.obj debugger.obj dict.obj diff.obj digraph.obj \ crypt.obj crypt_zip.obj debugger.obj dict.obj diff.obj digraph.obj \
edit.obj eval.obj evalfunc.obj ex_cmds.obj ex_cmds2.obj ex_docmd.obj \ edit.obj eval.obj evalfunc.obj evalvars.obj ex_cmds.obj ex_cmds2.obj \
ex_docmd.obj \
ex_eval.obj ex_getln.obj if_cscope.obj if_xcmdsrv.obj fileio.obj \ ex_eval.obj ex_getln.obj if_cscope.obj if_xcmdsrv.obj fileio.obj \
findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \ findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \
highlight.obj indent.obj insexpand.obj json.obj list.obj main.obj \ highlight.obj indent.obj insexpand.obj json.obj list.obj main.obj \
@@ -569,6 +571,10 @@ evalfunc.obj : evalfunc.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h option.h structs.h \ ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \ regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \
proto.h globals.h version.h proto.h globals.h version.h
evalvars.obj : evalvars.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \
proto.h globals.h version.h
ex_cmds.obj : ex_cmds.c vim.h [.auto]config.h feature.h os_unix.h \ ex_cmds.obj : ex_cmds.c vim.h [.auto]config.h feature.h os_unix.h \
ascii.h keymap.h term.h macros.h structs.h regexp.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \

View File

@@ -1596,6 +1596,7 @@ BASIC_SRC = \
edit.c \ edit.c \
eval.c \ eval.c \
evalfunc.c \ evalfunc.c \
evalvars.c \
ex_cmds.c \ ex_cmds.c \
ex_cmds2.c \ ex_cmds2.c \
ex_docmd.c \ ex_docmd.c \
@@ -1725,6 +1726,7 @@ OBJ_COMMON = \
objects/edit.o \ objects/edit.o \
objects/eval.o \ objects/eval.o \
objects/evalfunc.o \ objects/evalfunc.o \
objects/evalvars.o \
objects/ex_cmds.o \ objects/ex_cmds.o \
objects/ex_cmds2.o \ objects/ex_cmds2.o \
objects/ex_docmd.o \ objects/ex_docmd.o \
@@ -1867,6 +1869,7 @@ PRO_AUTO = \
edit.pro \ edit.pro \
eval.pro \ eval.pro \
evalfunc.pro \ evalfunc.pro \
evalvars.pro \
ex_cmds.pro \ ex_cmds.pro \
ex_cmds2.pro \ ex_cmds2.pro \
ex_docmd.pro \ ex_docmd.pro \
@@ -3052,6 +3055,9 @@ objects/eval.o: eval.c
objects/evalfunc.o: evalfunc.c objects/evalfunc.o: evalfunc.c
$(CCC) -o $@ evalfunc.c $(CCC) -o $@ evalfunc.c
objects/evalvars.o: evalvars.c
$(CCC) -o $@ evalvars.c
objects/ex_cmds.o: ex_cmds.c objects/ex_cmds.o: ex_cmds.c
$(CCC) -o $@ ex_cmds.c $(CCC) -o $@ ex_cmds.c
@@ -3570,6 +3576,10 @@ objects/evalfunc.o: evalfunc.c vim.h protodef.h auto/config.h feature.h os_unix.
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h version.h proto.h globals.h version.h
objects/evalvars.o: evalvars.c vim.h protodef.h auto/config.h feature.h \
os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
objects/ex_cmds.o: ex_cmds.c vim.h protodef.h auto/config.h feature.h os_unix.h \ objects/ex_cmds.o: ex_cmds.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \

View File

@@ -34,6 +34,7 @@ debugger.c | vim script debugger
diff.c | diff mode (vimdiff) diff.c | diff mode (vimdiff)
eval.c | expression evaluation eval.c | expression evaluation
evalfunc.c | built-in functions evalfunc.c | built-in functions
evalvars.c | vim variables
fileio.c | reading and writing files fileio.c | reading and writing files
findfile.c | search for files in 'path' findfile.c | search for files in 'path'
fold.c | folding fold.c | folding

1907
src/eval.c

File diff suppressed because it is too large Load Diff

View File

@@ -155,14 +155,11 @@ static void f_getqflist(typval_T *argvars, typval_T *rettv);
static void f_getreg(typval_T *argvars, typval_T *rettv); static void f_getreg(typval_T *argvars, typval_T *rettv);
static void f_getregtype(typval_T *argvars, typval_T *rettv); static void f_getregtype(typval_T *argvars, typval_T *rettv);
static void f_gettabinfo(typval_T *argvars, typval_T *rettv); static void f_gettabinfo(typval_T *argvars, typval_T *rettv);
static void f_gettabvar(typval_T *argvars, typval_T *rettv);
static void f_gettabwinvar(typval_T *argvars, typval_T *rettv);
static void f_gettagstack(typval_T *argvars, typval_T *rettv); static void f_gettagstack(typval_T *argvars, typval_T *rettv);
static void f_getwininfo(typval_T *argvars, typval_T *rettv); static void f_getwininfo(typval_T *argvars, typval_T *rettv);
static void f_getwinpos(typval_T *argvars, typval_T *rettv); static void f_getwinpos(typval_T *argvars, typval_T *rettv);
static void f_getwinposx(typval_T *argvars, typval_T *rettv); static void f_getwinposx(typval_T *argvars, typval_T *rettv);
static void f_getwinposy(typval_T *argvars, typval_T *rettv); static void f_getwinposy(typval_T *argvars, typval_T *rettv);
static void f_getwinvar(typval_T *argvars, typval_T *rettv);
static void f_glob(typval_T *argvars, typval_T *rettv); static void f_glob(typval_T *argvars, typval_T *rettv);
static void f_globpath(typval_T *argvars, typval_T *rettv); static void f_globpath(typval_T *argvars, typval_T *rettv);
static void f_glob2regpat(typval_T *argvars, typval_T *rettv); static void f_glob2regpat(typval_T *argvars, typval_T *rettv);
@@ -293,10 +290,7 @@ static void f_setloclist(typval_T *argvars, typval_T *rettv);
static void f_setpos(typval_T *argvars, typval_T *rettv); static void f_setpos(typval_T *argvars, typval_T *rettv);
static void f_setqflist(typval_T *argvars, typval_T *rettv); static void f_setqflist(typval_T *argvars, typval_T *rettv);
static void f_setreg(typval_T *argvars, typval_T *rettv); static void f_setreg(typval_T *argvars, typval_T *rettv);
static void f_settabvar(typval_T *argvars, typval_T *rettv);
static void f_settabwinvar(typval_T *argvars, typval_T *rettv);
static void f_settagstack(typval_T *argvars, typval_T *rettv); static void f_settagstack(typval_T *argvars, typval_T *rettv);
static void f_setwinvar(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_CRYPT #ifdef FEAT_CRYPT
static void f_sha256(typval_T *argvars, typval_T *rettv); static void f_sha256(typval_T *argvars, typval_T *rettv);
#endif /* FEAT_CRYPT */ #endif /* FEAT_CRYPT */
@@ -5314,58 +5308,6 @@ f_gettabinfo(typval_T *argvars, typval_T *rettv)
} }
} }
/*
* "gettabvar()" function
*/
static void
f_gettabvar(typval_T *argvars, typval_T *rettv)
{
win_T *oldcurwin;
tabpage_T *tp, *oldtabpage;
dictitem_T *v;
char_u *varname;
int done = FALSE;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
varname = tv_get_string_chk(&argvars[1]);
tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL));
if (tp != NULL && varname != NULL)
{
/* Set tp to be our tabpage, temporarily. Also set the window to the
* first window in the tabpage, otherwise the window is not valid. */
if (switch_win(&oldcurwin, &oldtabpage,
tp == curtab || tp->tp_firstwin == NULL ? firstwin
: tp->tp_firstwin, tp, TRUE) == OK)
{
/* look up the variable */
/* Let gettabvar({nr}, "") return the "t:" dictionary. */
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
if (v != NULL)
{
copy_tv(&v->di_tv, rettv);
done = TRUE;
}
}
/* restore previous notion of curwin */
restore_win(oldcurwin, oldtabpage, TRUE);
}
if (!done && argvars[2].v_type != VAR_UNKNOWN)
copy_tv(&argvars[2], rettv);
}
/*
* "gettabwinvar()" function
*/
static void
f_gettabwinvar(typval_T *argvars, typval_T *rettv)
{
getwinvar(argvars, rettv, 1);
}
/* /*
* "gettagstack()" function * "gettagstack()" function
*/ */
@@ -5624,15 +5566,6 @@ f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv)
#endif #endif
} }
/*
* "getwinvar()" function
*/
static void
f_getwinvar(typval_T *argvars, typval_T *rettv)
{
getwinvar(argvars, rettv, 0);
}
/* /*
* "glob()" function * "glob()" function
*/ */
@@ -10242,55 +10175,6 @@ free_lstval:
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
} }
/*
* "settabvar()" function
*/
static void
f_settabvar(typval_T *argvars, typval_T *rettv)
{
tabpage_T *save_curtab;
tabpage_T *tp;
char_u *varname, *tabvarname;
typval_T *varp;
rettv->vval.v_number = 0;
if (check_secure())
return;
tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL));
varname = tv_get_string_chk(&argvars[1]);
varp = &argvars[2];
if (varname != NULL && varp != NULL && tp != NULL)
{
save_curtab = curtab;
goto_tabpage_tp(tp, FALSE, FALSE);
tabvarname = alloc(STRLEN(varname) + 3);
if (tabvarname != NULL)
{
STRCPY(tabvarname, "t:");
STRCPY(tabvarname + 2, varname);
set_var(tabvarname, varp, TRUE);
vim_free(tabvarname);
}
/* Restore current tabpage */
if (valid_tabpage(save_curtab))
goto_tabpage_tp(save_curtab, FALSE, FALSE);
}
}
/*
* "settabwinvar()" function
*/
static void
f_settabwinvar(typval_T *argvars, typval_T *rettv)
{
setwinvar(argvars, rettv, 1);
}
/* /*
* "settagstack()" function * "settagstack()" function
*/ */
@@ -10347,15 +10231,6 @@ f_settagstack(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
} }
/*
* "setwinvar()" function
*/
static void
f_setwinvar(typval_T *argvars, typval_T *rettv)
{
setwinvar(argvars, rettv, 0);
}
#ifdef FEAT_CRYPT #ifdef FEAT_CRYPT
/* /*
* "sha256({string})" function * "sha256({string})" function

1946
src/evalvars.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1547,6 +1547,10 @@ EXTERN char e_re_damg[] INIT(= N_("E43: Damaged match string"));
EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program")); EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)")); EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
EXTERN char e_undefvar[] INIT(= N_("E121: Undefined variable: %s"));
EXTERN char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
EXTERN char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
EXTERN char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%s\"")); EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%s\""));
EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\""));
EXTERN char e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary")); EXTERN char e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary"));

View File

@@ -112,6 +112,7 @@ extern int _stricoll(char *a, char *b);
# ifdef FEAT_VIMINFO # ifdef FEAT_VIMINFO
# include "viminfo.pro" # include "viminfo.pro"
# endif # endif
# include "evalvars.pro"
/* These prototypes cannot be produced automatically. */ /* These prototypes cannot be produced automatically. */
int smsg(const char *, ...) int smsg(const char *, ...)

View File

@@ -1,4 +1,6 @@
/* eval.c */ /* eval.c */
varnumber_T num_divide(varnumber_T n1, varnumber_T n2);
varnumber_T num_modulus(varnumber_T n1, varnumber_T n2);
void eval_init(void); void eval_init(void);
void eval_clear(void); void eval_clear(void);
void set_internal_string_var(char_u *name, char_u *value); void set_internal_string_var(char_u *name, char_u *value);
@@ -17,6 +19,10 @@ int skip_expr(char_u **pp);
char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert); 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_u *eval_to_string_safe(char_u *arg, char_u **nextcmd, int use_sandbox);
varnumber_T eval_to_number(char_u *expr); varnumber_T eval_to_number(char_u *expr);
void list_vim_vars(int *first);
void list_script_vars(int *first);
int is_vimvarht(hashtab_T *ht);
int is_compatht(hashtab_T *ht);
void prepare_vimvar(int idx, typval_T *save_tv); void prepare_vimvar(int idx, typval_T *save_tv);
void restore_vimvar(int idx, typval_T *save_tv); void restore_vimvar(int idx, typval_T *save_tv);
list_T *eval_spell_expr(char_u *badword, char_u *expr); list_T *eval_spell_expr(char_u *badword, char_u *expr);
@@ -27,18 +33,13 @@ varnumber_T call_func_retnr(char_u *func, int argc, typval_T *argv);
void *call_func_retstr(char_u *func, int argc, typval_T *argv); void *call_func_retstr(char_u *func, int argc, typval_T *argv);
void *call_func_retlist(char_u *func, int argc, typval_T *argv); void *call_func_retlist(char_u *func, int argc, typval_T *argv);
int eval_foldexpr(char_u *arg, int *cp); int eval_foldexpr(char_u *arg, int *cp);
void ex_let(exarg_T *eap);
void ex_const(exarg_T *eap);
void list_hashtable_vars(hashtab_T *ht, char *prefix, int empty, int *first);
char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags); char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags);
void clear_lval(lval_T *lp); void clear_lval(lval_T *lp);
void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, int is_const, char_u *op);
void *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip); void *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip);
int next_for_item(void *fi_void, char_u *arg); int next_for_item(void *fi_void, char_u *arg);
void free_for_info(void *fi_void); void free_for_info(void *fi_void);
void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx); void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx);
void ex_unlet(exarg_T *eap);
void ex_lockvar(exarg_T *eap);
int do_unlet(char_u *name, int forceit);
void del_menutrans_vars(void); void del_menutrans_vars(void);
char_u *get_user_var_name(expand_T *xp, int idx); char_u *get_user_var_name(expand_T *xp, int idx);
int pattern_match(char_u *pat, char_u *text, int ic); int pattern_match(char_u *pat, char_u *text, int ic);
@@ -62,7 +63,9 @@ char_u *string_quote(char_u *str, int function);
int string2float(char_u *text, float_T *value); int string2float(char_u *text, float_T *value);
pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum); pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum);
int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp); int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp);
int get_env_len(char_u **arg);
int get_id_len(char_u **arg); int get_id_len(char_u **arg);
int get_name_len(char_u **arg, char_u **alias, int evaluate, int verbose);
char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end, int flags); char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end, int flags);
int eval_isnamec(int c); int eval_isnamec(int c);
int eval_isnamec1(int c); int eval_isnamec1(int c);
@@ -98,18 +101,9 @@ char_u *tv_get_string_buf_chk(typval_T *varp, char_u *buf);
dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload); dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload);
dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload); dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);
hashtab_T *find_var_ht(char_u *name, char_u **varname); hashtab_T *find_var_ht(char_u *name, char_u **varname);
char_u *get_var_value(char_u *name);
void new_script_vars(scid_T id); void new_script_vars(scid_T id);
void init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope); void init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope);
void unref_var_dict(dict_T *dict); void unref_var_dict(dict_T *dict);
void vars_clear(hashtab_T *ht);
void vars_clear_ext(hashtab_T *ht, int free_val);
void set_var(char_u *name, typval_T *tv, int copy);
int var_check_ro(int flags, char_u *name, int use_gettext);
int var_check_fixed(int flags, char_u *name, int use_gettext);
int var_check_func_name(char_u *name, int new_var);
int var_check_lock(int lock, char_u *name, int use_gettext);
int valid_varname(char_u *varname);
void copy_tv(typval_T *from, typval_T *to); void copy_tv(typval_T *from, typval_T *to);
int item_copy(typval_T *from, typval_T *to, int deep, int copyID); int item_copy(typval_T *from, typval_T *to, int deep, int copyID);
void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog, int secret); void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog, int secret);
@@ -119,8 +113,7 @@ void ex_execute(exarg_T *eap);
win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp); win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp);
win_T *find_win_by_nr_or_id(typval_T *vp); win_T *find_win_by_nr_or_id(typval_T *vp);
win_T *find_tabwin(typval_T *wvp, typval_T *tvp, tabpage_T **ptp); win_T *find_tabwin(typval_T *wvp, typval_T *tvp, tabpage_T **ptp);
void getwinvar(typval_T *argvars, typval_T *rettv, int off); char_u *find_option_end(char_u **arg, int *opt_flags);
void setwinvar(typval_T *argvars, typval_T *rettv, int off);
char_u *autoload_name(char_u *name); char_u *autoload_name(char_u *name);
int script_autoload(char_u *name, int reload); int script_autoload(char_u *name, int reload);
void last_set_msg(sctx_T script_ctx); void last_set_msg(sctx_T script_ctx);
@@ -128,7 +121,6 @@ void reset_v_option_vars(void);
void assert_error(garray_T *gap); void assert_error(garray_T *gap);
int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int type_is, int ic); int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int type_is, int ic);
char_u *typval_tostring(typval_T *arg); char_u *typval_tostring(typval_T *arg);
int var_exists(char_u *var);
int modify_fname(char_u *src, int tilde_file, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen); int modify_fname(char_u *src, int tilde_file, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen);
char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, typval_T *expr, char_u *flags); char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, typval_T *expr, char_u *flags);
void filter_map(typval_T *argvars, typval_T *rettv, int map); void filter_map(typval_T *argvars, typval_T *rettv, int map);

29
src/proto/evalvars.pro Normal file
View File

@@ -0,0 +1,29 @@
/* evalvars.c */
void ex_let(exarg_T *eap);
void ex_const(exarg_T *eap);
int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon, int var_count, int is_const, char_u *op);
char_u *skip_var_list(char_u *arg, int *var_count, int *semicolon);
void list_hashtable_vars(hashtab_T *ht, char *prefix, int empty, int *first);
void ex_unlet(exarg_T *eap);
void ex_lockvar(exarg_T *eap);
int do_unlet(char_u *name, int forceit);
int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
char_u *get_var_value(char_u *name);
void vars_clear(hashtab_T *ht);
void vars_clear_ext(hashtab_T *ht, int free_val);
void delete_var(hashtab_T *ht, hashitem_T *hi);
void set_var(char_u *name, typval_T *tv, int copy);
void set_var_const(char_u *name, typval_T *tv, int copy, int is_const);
int var_check_ro(int flags, char_u *name, int use_gettext);
int var_check_fixed(int flags, char_u *name, int use_gettext);
int var_check_func_name(char_u *name, int new_var);
int var_check_lock(int lock, char_u *name, int use_gettext);
int valid_varname(char_u *varname);
int var_exists(char_u *var);
void f_gettabvar(typval_T *argvars, typval_T *rettv);
void f_gettabwinvar(typval_T *argvars, typval_T *rettv);
void f_getwinvar(typval_T *argvars, typval_T *rettv);
void f_settabvar(typval_T *argvars, typval_T *rettv);
void f_settabwinvar(typval_T *argvars, typval_T *rettv);
void f_setwinvar(typval_T *argvars, typval_T *rettv);
/* vim: set ft=c : */

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1933,
/**/ /**/
1932, 1932,
/**/ /**/

View File

@@ -2003,6 +2003,8 @@ typedef int sock_T;
#define VAR_TYPE_CHANNEL 9 #define VAR_TYPE_CHANNEL 9
#define VAR_TYPE_BLOB 10 #define VAR_TYPE_BLOB 10
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
#ifdef FEAT_CLIPBOARD #ifdef FEAT_CLIPBOARD
/* VIM_ATOM_NAME is the older Vim-specific selection type for X11. Still /* VIM_ATOM_NAME is the older Vim-specific selection type for X11. Still