0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.2063

Problem:    eval.c is still too big.
Solution:   Split off internal functions to evalfunc.c.
This commit is contained in:
Bram Moolenaar
2016-07-17 22:13:49 +02:00
parent 840268400d
commit 73dad1e64c
20 changed files with 13458 additions and 13384 deletions

View File

@@ -23,6 +23,7 @@ SRC_ALL = \
src/digraph.c \
src/edit.c \
src/eval.c \
src/evalfunc.c \
src/ex_cmds.c \
src/ex_cmds.h \
src/ex_cmds2.c \
@@ -134,6 +135,7 @@ SRC_ALL = \
src/proto/digraph.pro \
src/proto/edit.pro \
src/proto/eval.pro \
src/proto/evalfunc.pro \
src/proto/ex_cmds.pro \
src/proto/ex_cmds2.pro \
src/proto/ex_docmd.pro \

View File

@@ -548,6 +548,7 @@ vimobj = \
$(OBJDIR)\digraph.obj \
$(OBJDIR)\edit.obj \
$(OBJDIR)\eval.obj \
$(OBJDIR)\evalfunc.obj \
$(OBJDIR)\ex_cmds.obj \
$(OBJDIR)\ex_cmds2.obj \
$(OBJDIR)\ex_docmd.obj \

View File

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

View File

@@ -37,6 +37,7 @@ SRC = \
digraph.c \
edit.c \
eval.c \
evalfunc.c \
ex_cmds.c \
ex_cmds2.c \
ex_docmd.c \
@@ -91,6 +92,7 @@ OBJ = o/arabic.o \
o/digraph.o \
o/edit.o \
o/eval.o \
o/evalfunc.o \
o/ex_cmds.o \
o/ex_cmds2.o \
o/ex_docmd.o \
@@ -175,6 +177,8 @@ o/edit.o: edit.c $(SYMS)
o/eval.o: eval.c $(SYMS)
o/evalfunc.o: evalfunc.c $(SYMS)
o/ex_cmds.o: ex_cmds.c $(SYMS)
o/ex_cmds2.o: ex_cmds2.c $(SYMS)

View File

@@ -221,6 +221,7 @@ LINK32_OBJS= \
"$(INTDIR)/digraph.obj" \
"$(INTDIR)/edit.obj" \
"$(INTDIR)/eval.obj" \
"$(INTDIR)/evalfunc.obj" \
"$(INTDIR)/ex_cmds.obj" \
"$(INTDIR)/ex_cmds2.obj" \
"$(INTDIR)/ex_docmd.obj" \
@@ -379,6 +380,10 @@ SOURCE=.\eval.c
# End Source File
# Begin Source File
SOURCE=.\evalfunc.c
# End Source File
# Begin Source File
SOURCE=.\ex_cmds.c
# End Source File
# Begin Source File

View File

@@ -47,6 +47,7 @@ SRC = arabic.c \
digraph.c \
edit.c \
eval.c \
evalfunc.c \
ex_cmds.c \
ex_cmds2.c \
ex_docmd.c \
@@ -103,6 +104,7 @@ OBJ = obj/arabic.o \
obj/digraph.o \
obj/edit.o \
obj/eval.o \
obj/evalfunc.o \
obj/ex_cmds.o \
obj/ex_cmds2.o \
obj/ex_docmd.o \
@@ -157,6 +159,7 @@ PRO = proto/arabic.pro \
proto/digraph.pro \
proto/edit.pro \
proto/eval.pro \
proto/evalfunc.pro \
proto/ex_cmds.pro \
proto/ex_cmds2.pro \
proto/ex_docmd.pro \
@@ -277,6 +280,9 @@ obj/edit.o: edit.c
obj/eval.o: eval.c
$(CCSYM) $@ eval.c
obj/evalfunc.o: evalfunc.c
$(CCSYM) $@ evalfunc.c
obj/ex_cmds.o: ex_cmds.c
$(CCSYM) $@ ex_cmds.c

View File

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

View File

@@ -559,6 +559,7 @@ OBJ = \
$(OUTDIR)\digraph.obj \
$(OUTDIR)\edit.obj \
$(OUTDIR)\eval.obj \
$(OUTDIR)\evalfunc.obj \
$(OUTDIR)\ex_cmds.obj \
$(OUTDIR)\ex_cmds2.obj \
$(OUTDIR)\ex_docmd.obj \
@@ -1175,6 +1176,8 @@ $(OUTDIR)/edit.obj: $(OUTDIR) edit.c $(INCL)
$(OUTDIR)/eval.obj: $(OUTDIR) eval.c $(INCL)
$(OUTDIR)/evalfunc.obj: $(OUTDIR) evalfunc.c $(INCL)
$(OUTDIR)/ex_cmds.obj: $(OUTDIR) ex_cmds.c $(INCL)
$(OUTDIR)/ex_cmds2.obj: $(OUTDIR) ex_cmds2.c $(INCL)
@@ -1372,6 +1375,7 @@ proto.h: \
proto/digraph.pro \
proto/edit.pro \
proto/eval.pro \
proto/evalfunc.pro \
proto/ex_cmds.pro \
proto/ex_cmds2.pro \
proto/ex_docmd.pro \

View File

@@ -100,6 +100,7 @@ SRC = \
digraph.c \
edit.c \
eval.c \
evalfunc.c \
ex_cmds.c \
ex_cmds2.c \
ex_docmd.c \
@@ -155,6 +156,7 @@ OBJ = \
digraph.o \
edit.o \
eval.o \
evalfunc.o \
ex_cmds.o \
ex_cmds2.o \
ex_docmd.o \
@@ -210,6 +212,7 @@ PRO = \
proto/digraph.pro \
proto/edit.pro \
proto/eval.pro \
proto/evalfunc.pro \
proto/ex_cmds.pro \
proto/ex_cmds2.pro \
proto/ex_docmd.pro \
@@ -330,6 +333,8 @@ edit.o: edit.c
proto/edit.pro: edit.c
eval.o: eval.c
proto/eval.pro: eval.c
evalfunc.o: evalfunc.c
proto/evalfunc.pro: evalfunc.c
ex_cmds.o: ex_cmds.c
proto/ex_cmds.pro: ex_cmds.c
ex_cmds2.o: ex_cmds2.c

View File

@@ -1489,6 +1489,7 @@ BASIC_SRC = \
digraph.c \
edit.c \
eval.c \
evalfunc.c \
ex_cmds.c \
ex_cmds2.c \
ex_docmd.c \
@@ -1593,6 +1594,7 @@ OBJ_COMMON = \
objects/digraph.o \
objects/edit.o \
objects/eval.o \
objects/evalfunc.o \
objects/ex_cmds.o \
objects/ex_cmds2.o \
objects/ex_docmd.o \
@@ -1683,6 +1685,7 @@ PRO_AUTO = \
digraph.pro \
edit.pro \
eval.pro \
evalfunc.pro \
ex_cmds.pro \
ex_cmds2.pro \
ex_docmd.pro \
@@ -2830,6 +2833,9 @@ objects/edit.o: edit.c
objects/eval.o: eval.c
$(CCC) -o $@ eval.c
objects/evalfunc.o: evalfunc.c
$(CCC) -o $@ evalfunc.c
objects/ex_cmds.o: ex_cmds.c
$(CCC) -o $@ ex_cmds.c
@@ -3220,6 +3226,10 @@ objects/eval.o: eval.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
gui_beval.h proto/gui_beval.pro alloc.h ex_cmds.h proto.h globals.h \
farsi.h arabic.h version.h
objects/evalfunc.o: evalfunc.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
gui_beval.h proto/gui_beval.pro alloc.h ex_cmds.h proto.h globals.h \
farsi.h arabic.h version.h
objects/ex_cmds.o: ex_cmds.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
gui_beval.h proto/gui_beval.pro alloc.h ex_cmds.h proto.h globals.h \

14145
src/eval.c

File diff suppressed because it is too large Load Diff

12552
src/evalfunc.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1538,6 +1538,8 @@ EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required"));
EXTERN char_u e_listidx[] INIT(= N_("E684: list index out of range: %ld"));
EXTERN char_u e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
EXTERN char_u e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s"));
EXTERN char_u e_listreq[] INIT(= N_("E714: List required"));
EXTERN char_u e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
#endif
#ifdef FEAT_QUICKFIX
EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));

View File

@@ -884,4 +884,44 @@ failret:
return OK;
}
#endif /* defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) */
/*
* Write list of strings to file
*/
int
write_list(FILE *fd, list_T *list, int binary)
{
listitem_T *li;
int c;
int ret = OK;
char_u *s;
for (li = list->lv_first; li != NULL; li = li->li_next)
{
for (s = get_tv_string(&li->li_tv); *s != NUL; ++s)
{
if (*s == '\n')
c = putc(NUL, fd);
else
c = putc(*s, fd);
if (c == EOF)
{
ret = FAIL;
break;
}
}
if (!binary || li->li_next != NULL)
if (putc('\n', fd) == EOF)
{
ret = FAIL;
break;
}
if (ret == FAIL)
{
EMSG(_(e_write));
break;
}
}
return ret;
}
#endif /* defined(FEAT_EVAL) */

View File

@@ -72,6 +72,7 @@ extern int _stricoll(char *a, char *b);
# include "digraph.pro"
# include "edit.pro"
# include "eval.pro"
# include "evalfunc.pro"
# include "ex_cmds.pro"
# include "ex_cmds2.pro"
# include "ex_docmd.pro"

View File

@@ -25,6 +25,7 @@ void *call_func_retlist(char_u *func, int argc, char_u **argv, int safe);
int eval_foldexpr(char_u *arg, int *cp);
void ex_let(exarg_T *eap);
void list_hashtable_vars(hashtab_T *ht, char_u *prefix, int empty, int *first);
int check_changedtick(char_u *arg);
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 *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip);
@@ -38,6 +39,7 @@ void del_menutrans_vars(void);
char_u *get_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(char_u **arg, typval_T *rettv, int evaluate);
void partial_unref(partial_T *pt);
int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
int get_copyID(void);
@@ -50,18 +52,10 @@ char_u *echo_string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID);
char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID);
char_u *string_quote(char_u *str, int function);
int string2float(char_u *text, float_T *value);
char_u *get_function_name(expand_T *xp, int idx);
char_u *get_expr_name(expand_T *xp, int idx);
int find_internal_func(char_u *name);
int call_internal_func(char_u *name, int argcount, typval_T *argvars, typval_T *rettv);
buf_T *buflist_find_by_name(char_u *name, int curtab_only);
void execute_redir_str(char_u *value, int value_len);
void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv);
float_T vim_round(float_T f);
long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit);
char_u *get_callback(typval_T *arg, partial_T **pp);
void free_callback(char_u *callback, partial_T *partial);
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 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);
int eval_isnamec(int c);
int eval_isnamec1(int c);
@@ -78,32 +72,43 @@ void set_reg_var(int c);
char_u *v_exception(char_u *oldval);
char_u *v_throwpoint(char_u *oldval);
char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
int handle_subscript(char_u **arg, typval_T *rettv, int evaluate, int verbose);
typval_T *alloc_tv(void);
void free_tv(typval_T *varp);
void clear_tv(typval_T *varp);
void init_tv(typval_T *varp);
varnumber_T get_tv_number(typval_T *varp);
varnumber_T get_tv_number_chk(typval_T *varp, int *denote);
float_T get_tv_float(typval_T *varp);
char_u *get_tv_string(typval_T *varp);
char_u *get_tv_string_buf(typval_T *varp, char_u *buf);
char_u *get_tv_string_chk(typval_T *varp);
char_u *get_tv_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_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);
char_u *get_var_value(char_u *name);
void new_script_vars(scid_T id);
void init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope);
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 valid_varname(char_u *varname);
int tv_check_lock(int lock, char_u *name, int use_gettext);
void copy_tv(typval_T *from, typval_T *to);
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 ex_echo(exarg_T *eap);
void ex_echohl(exarg_T *eap);
void ex_execute(exarg_T *eap);
win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp);
win_T *find_tabwin(typval_T *wvp, typval_T *tvp);
void getwinvar(typval_T *argvars, typval_T *rettv, int off);
void setwinvar(typval_T *argvars, typval_T *rettv, int off);
char_u *autoload_name(char_u *name);
int script_autoload(char_u *name, int reload);
int read_viminfo_varlist(vir_T *virp, int writing);
@@ -112,6 +117,15 @@ int store_session_globals(FILE *fd);
void last_set_msg(scid_T scriptID);
void ex_oldfiles(exarg_T *eap);
void reset_v_option_vars(void);
void prepare_assert_error(garray_T *gap);
void assert_error(garray_T *gap);
void assert_equal_common(typval_T *argvars, assert_type_T atype);
void assert_match_common(typval_T *argvars, assert_type_T atype);
void assert_bool(typval_T *argvars, int isTrue);
void assert_exception(typval_T *argvars);
void assert_fails(typval_T *argvars);
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);
int modify_fname(char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen);
char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, char_u *flags);
void filter_map(typval_T *argvars, typval_T *rettv, int map);
/* vim: set ft=c : */

13
src/proto/evalfunc.pro Normal file
View File

@@ -0,0 +1,13 @@
/* evalfunc.c */
char_u *get_function_name(expand_T *xp, int idx);
char_u *get_expr_name(expand_T *xp, int idx);
int find_internal_func(char_u *name);
int call_internal_func(char_u *name, int argcount, typval_T *argvars, typval_T *rettv);
buf_T *buflist_find_by_name(char_u *name, int curtab_only);
void execute_redir_str(char_u *value, int value_len);
void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv);
float_T vim_round(float_T f);
long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit);
char_u *get_callback(typval_T *arg, partial_T **pp);
void free_callback(char_u *callback, partial_T *partial);
/* vim: set ft=c : */

View File

@@ -31,4 +31,5 @@ void vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2);
char_u *list2string(typval_T *tv, int copyID, int restore_copyID);
int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, int restore_copyID, int copyID);
int get_list_tv(char_u **arg, typval_T *rettv, int evaluate);
int write_list(FILE *fd, list_T *list, int binary);
/* vim: set ft=c : */

View File

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

View File

@@ -2051,6 +2051,15 @@ typedef struct _stat64 stat_T;
typedef struct stat stat_T;
#endif
typedef enum
{
ASSERT_EQUAL,
ASSERT_NOTEQUAL,
ASSERT_MATCH,
ASSERT_NOTMATCH,
ASSERT_OTHER
} assert_type_T;
#include "ex_cmds.h" /* Ex command defines */
#include "proto.h" /* function prototypes */