summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Filelist2
-rw-r--r--src/Make_bc5.mak1
-rw-r--r--src/Make_cyg_ming.mak1
-rw-r--r--src/Make_dice.mak4
-rw-r--r--src/Make_ivc.mak5
-rw-r--r--src/Make_manx.mak6
-rw-r--r--src/Make_morph.mak1
-rw-r--r--src/Make_mvc.mak4
-rw-r--r--src/Make_sas.mak5
-rw-r--r--src/Makefile10
-rw-r--r--src/eval.c14147
-rw-r--r--src/evalfunc.c12552
-rw-r--r--src/globals.h2
-rw-r--r--src/list.c42
-rw-r--r--src/proto.h1
-rw-r--r--src/proto/eval.pro36
-rw-r--r--src/proto/evalfunc.pro13
-rw-r--r--src/proto/list.pro1
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h9
20 files changed, 13459 insertions, 13385 deletions
diff --git a/Filelist b/Filelist
index dc9a2308b7..48778fc6c9 100644
--- a/Filelist
+++ b/Filelist
@@ -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 \
diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak
index 55a9e0f582..54665668ab 100644
--- a/src/Make_bc5.mak
+++ b/src/Make_bc5.mak
@@ -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 \
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
index cc68f442cd..a6edef632b 100644
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -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 \
diff --git a/src/Make_dice.mak b/src/Make_dice.mak
index fe8f2c8b46..00d38f6f9a 100644
--- a/src/Make_dice.mak
+++ b/src/Make_dice.mak
@@ -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)
diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak
index 71cdef05ad..449d537bc8 100644
--- a/src/Make_ivc.mak
+++ b/src/Make_ivc.mak
@@ -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
diff --git a/src/Make_manx.mak b/src/Make_manx.mak
index 81a2c192e8..1d8686c249 100644
--- a/src/Make_manx.mak
+++ b/src/Make_manx.mak
@@ -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
diff --git a/src/Make_morph.mak b/src/Make_morph.mak
index cfac107813..daebf81a3e 100644
--- a/src/Make_morph.mak
+++ b/src/Make_morph.mak
@@ -35,6 +35,7 @@ SRC = arabic.c \
digraph.c \
edit.c \
eval.c \
+ evalfunc.c \
ex_cmds.c \
ex_cmds2.c \
ex_docmd.c \
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 10a1cd8427..b331bf9dbf 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -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 \
diff --git a/src/Make_sas.mak b/src/Make_sas.mak
index b466173c77..f29c4d35e9 100644
--- a/src/Make_sas.mak
+++ b/src/Make_sas.mak
@@ -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
diff --git a/src/Makefile b/src/Makefile
index 7ab4d328f6..c888661eb3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/eval.c b/src/eval.c
index f930e47b62..5821079a10 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -16,29 +16,15 @@
#if defined(FEAT_EVAL) || defined(PROTO)
-#ifdef AMIGA
-# include <time.h> /* for strftime() */
-#endif
-
#ifdef VMS
# include <float.h>
#endif
-#ifdef MACOS
-# include <time.h> /* for time_t */
-#endif
-
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
static char *e_letunexp = N_("E18: Unexpected characters in :let");
static char *e_undefvar = N_("E121: Undefined variable: %s");
static char *e_missbrac = N_("E111: Missing ']'");
-static char *e_listarg = N_("E686: Argument of %s must be a List");
-static char *e_listdictarg = N_("E712: Argument of %s must be a List or Dictionary");
-static char *e_listreq = N_("E714: List required");
-#ifdef FEAT_QUICKFIX
-static char *e_stringreq = N_("E928: String required");
-#endif
static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
static char *e_letwrong = N_("E734: Wrong variable type for %s=");
static char *e_illvar = N_("E461: Illegal variable name: %s");
@@ -101,7 +87,6 @@ typedef struct
* The reason to use this table anyway is for very quick access to the
* variables with the VV_ defines.
*/
-#include "version.h"
/* values for vv_flags: */
#define VV_COMPAT 1 /* compatible, also used without "v:" */
@@ -206,8 +191,6 @@ static struct vimvar
static dictitem_T vimvars_var; /* variable used for v: */
#define vimvarht vimvardict.dv_hashtab
-static void prepare_vimvar(int idx, typval_T *save_tv);
-static void restore_vimvar(int idx, typval_T *save_tv);
static int ex_let_vars(char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars);
static char_u *skip_var_list(char_u *arg, int *var_count, int *semicolon);
static char_u *skip_var_one(char_u *arg);
@@ -221,14 +204,12 @@ static void list_vim_vars(int *first);
static void list_script_vars(int *first);
static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first);
static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op);
-static int check_changedtick(char_u *arg);
static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op);
static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op);
static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep);
static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit);
static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock);
static void item_lock(typval_T *tv, int deep, int lock);
-static int tv_islocked(typval_T *tv);
static int eval2(char_u **arg, typval_T *rettv, int evaluate);
static int eval3(char_u **arg, typval_T *rettv, int evaluate);
@@ -238,445 +219,29 @@ static int eval6(char_u **arg, typval_T *rettv, int evaluate, int want_string);
static int eval7(char_u **arg, typval_T *rettv, int evaluate, int want_string);
static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose);
-static int get_option_tv(char_u **arg, typval_T *rettv, int evaluate);
static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate);
static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate);
static int free_unref_items(int copyID);
static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate);
-static int non_zero_arg(typval_T *argvars);
-#ifdef FEAT_FLOAT
-static void f_abs(typval_T *argvars, typval_T *rettv);
-static void f_acos(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_add(typval_T *argvars, typval_T *rettv);
-static void f_and(typval_T *argvars, typval_T *rettv);
-static void f_append(typval_T *argvars, typval_T *rettv);
-static void f_argc(typval_T *argvars, typval_T *rettv);
-static void f_argidx(typval_T *argvars, typval_T *rettv);
-static void f_arglistid(typval_T *argvars, typval_T *rettv);
-static void f_argv(typval_T *argvars, typval_T *rettv);
-static void f_assert_equal(typval_T *argvars, typval_T *rettv);
-static void f_assert_exception(typval_T *argvars, typval_T *rettv);
-static void f_assert_fails(typval_T *argvars, typval_T *rettv);
-static void f_assert_false(typval_T *argvars, typval_T *rettv);
-static void f_assert_match(typval_T *argvars, typval_T *rettv);
-static void f_assert_notequal(typval_T *argvars, typval_T *rettv);
-static void f_assert_notmatch(typval_T *argvars, typval_T *rettv);
-static void f_assert_true(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_asin(typval_T *argvars, typval_T *rettv);
-static void f_atan(typval_T *argvars, typval_T *rettv);
-static void f_atan2(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_browse(typval_T *argvars, typval_T *rettv);
-static void f_browsedir(typval_T *argvars, typval_T *rettv);
-static void f_bufexists(typval_T *argvars, typval_T *rettv);
-static void f_buflisted(typval_T *argvars, typval_T *rettv);
-static void f_bufloaded(typval_T *argvars, typval_T *rettv);
-static void f_bufname(typval_T *argvars, typval_T *rettv);
-static void f_bufnr(typval_T *argvars, typval_T *rettv);
-static void f_bufwinid(typval_T *argvars, typval_T *rettv);
-static void f_bufwinnr(typval_T *argvars, typval_T *rettv);
-static void f_byte2line(typval_T *argvars, typval_T *rettv);
-static void byteidx(typval_T *argvars, typval_T *rettv, int comp);
-static void f_byteidx(typval_T *argvars, typval_T *rettv);
-static void f_byteidxcomp(typval_T *argvars, typval_T *rettv);
-static void f_call(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_ceil(typval_T *argvars, typval_T *rettv);
-#endif
-#ifdef FEAT_JOB_CHANNEL
-static void f_ch_close(typval_T *argvars, typval_T *rettv);
-static void f_ch_evalexpr(typval_T *argvars, typval_T *rettv);
-static void f_ch_evalraw(typval_T *argvars, typval_T *rettv);
-static void f_ch_getbufnr(typval_T *argvars, typval_T *rettv);
-static void f_ch_getjob(typval_T *argvars, typval_T *rettv);
-static void f_ch_info(typval_T *argvars, typval_T *rettv);
-static void f_ch_log(typval_T *argvars, typval_T *rettv);
-static void f_ch_logfile(typval_T *argvars, typval_T *rettv);
-static void f_ch_open(typval_T *argvars, typval_T *rettv);
-static void f_ch_read(typval_T *argvars, typval_T *rettv);
-static void f_ch_readraw(typval_T *argvars, typval_T *rettv);
-static void f_ch_sendexpr(typval_T *argvars, typval_T *rettv);
-static void f_ch_sendraw(typval_T *argvars, typval_T *rettv);
-static void f_ch_setoptions(typval_T *argvars, typval_T *rettv);
-static void f_ch_status(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_changenr(typval_T *argvars, typval_T *rettv);
-static void f_char2nr(typval_T *argvars, typval_T *rettv);
-static void f_cindent(typval_T *argvars, typval_T *rettv);
-static void f_clearmatches(typval_T *argvars, typval_T *rettv);
-static void f_col(typval_T *argvars, typval_T *rettv);
-#if defined(FEAT_INS_EXPAND)
-static void f_complete(typval_T *argvars, typval_T *rettv);
-static void f_complete_add(typval_T *argvars, typval_T *rettv);
-static void f_complete_check(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_confirm(typval_T *argvars, typval_T *rettv);
-static void f_copy(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_cos(typval_T *argvars, typval_T *rettv);
-static void f_cosh(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_count(typval_T *argvars, typval_T *rettv);
-static void f_cscope_connection(typval_T *argvars, typval_T *rettv);
-static void f_cursor(typval_T *argsvars, typval_T *rettv);
-static void f_deepcopy(typval_T *argvars, typval_T *rettv);
-static void f_delete(typval_T *argvars, typval_T *rettv);
-static void f_did_filetype(typval_T *argvars, typval_T *rettv);
-static void f_diff_filler(typval_T *argvars, typval_T *rettv);
-static void f_diff_hlID(typval_T *argvars, typval_T *rettv);
-static void f_empty(typval_T *argvars, typval_T *rettv);
-static void f_escape(typval_T *argvars, typval_T *rettv);
-static void f_eval(typval_T *argvars, typval_T *rettv);
-static void f_eventhandler(typval_T *argvars, typval_T *rettv);
-static void f_executable(typval_T *argvars, typval_T *rettv);
-static void f_execute(typval_T *argvars, typval_T *rettv);
-static void f_exepath(typval_T *argvars, typval_T *rettv);
-static void f_exists(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_exp(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_expand(typval_T *argvars, typval_T *rettv);
-static void f_extend(typval_T *argvars, typval_T *rettv);
-static void f_feedkeys(typval_T *argvars, typval_T *rettv);
-static void f_filereadable(typval_T *argvars, typval_T *rettv);
-static void f_filewritable(typval_T *argvars, typval_T *rettv);
-static void f_filter(typval_T *argvars, typval_T *rettv);
-static void f_finddir(typval_T *argvars, typval_T *rettv);
-static void f_findfile(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_float2nr(typval_T *argvars, typval_T *rettv);
-static void f_floor(typval_T *argvars, typval_T *rettv);
-static void f_fmod(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_fnameescape(typval_T *argvars, typval_T *rettv);
-static void f_fnamemodify(typval_T *argvars, typval_T *rettv);
-static void f_foldclosed(typval_T *argvars, typval_T *rettv);
-static void f_foldclosedend(typval_T *argvars, typval_T *rettv);
-static void f_foldlevel(typval_T *argvars, typval_T *rettv);
-static void f_foldtext(typval_T *argvars, typval_T *rettv);
-static void f_foldtextresult(typval_T *argvars, typval_T *rettv);
-static void f_foreground(typval_T *argvars, typval_T *rettv);
-static void f_function(typval_T *argvars, typval_T *rettv);
-static void f_garbagecollect(typval_T *argvars, typval_T *rettv);
-static void f_get(typval_T *argvars, typval_T *rettv);
-static void f_getbufline(typval_T *argvars, typval_T *rettv);
-static void f_getbufvar(typval_T *argvars, typval_T *rettv);
-static void f_getchar(typval_T *argvars, typval_T *rettv);
-static void f_getcharmod(typval_T *argvars, typval_T *rettv);
-static void f_getcharsearch(typval_T *argvars, typval_T *rettv);
-static void f_getcmdline(typval_T *argvars, typval_T *rettv);
-#if defined(FEAT_CMDL_COMPL)
-static void f_getcompletion(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_getcmdpos(typval_T *argvars, typval_T *rettv);
-static void f_getcmdtype(typval_T *argvars, typval_T *rettv);
-static void f_getcmdwintype(typval_T *argvars, typval_T *rettv);
-static void f_getcwd(typval_T *argvars, typval_T *rettv);
-static void f_getfontname(typval_T *argvars, typval_T *rettv);
-static void f_getfperm(typval_T *argvars, typval_T *rettv);
-static void f_getfsize(typval_T *argvars, typval_T *rettv);
-static void f_getftime(typval_T *argvars, typval_T *rettv);
-static void f_getftype(typval_T *argvars, typval_T *rettv);
-static void f_getline(typval_T *argvars, typval_T *rettv);
-static void f_getmatches(typval_T *argvars, typval_T *rettv);
-static void f_getpid(typval_T *argvars, typval_T *rettv);
-static void f_getcurpos(typval_T *argvars, typval_T *rettv);
-static void f_getpos(typval_T *argvars, typval_T *rettv);
-static void f_getqflist(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_gettabvar(typval_T *argvars, typval_T *rettv);
-static void f_gettabwinvar(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_getwinvar(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_glob2regpat(typval_T *argvars, typval_T *rettv);
-static void f_has(typval_T *argvars, typval_T *rettv);
-static void f_has_key(typval_T *argvars, typval_T *rettv);
-static void f_haslocaldir(typval_T *argvars, typval_T *rettv);
-static void f_hasmapto(typval_T *argvars, typval_T *rettv);
-static void f_histadd(typval_T *argvars, typval_T *rettv);
-static void f_histdel(typval_T *argvars, typval_T *rettv);
-static void f_histget(typval_T *argvars, typval_T *rettv);
-static void f_histnr(typval_T *argvars, typval_T *rettv);
-static void f_hlID(typval_T *argvars, typval_T *rettv);
-static void f_hlexists(typval_T *argvars, typval_T *rettv);
-static void f_hostname(typval_T *argvars, typval_T *rettv);
-static void f_iconv(typval_T *argvars, typval_T *rettv);
-static void f_indent(typval_T *argvars, typval_T *rettv);
-static void f_index(typval_T *argvars, typval_T *rettv);
-static void f_input(typval_T *argvars, typval_T *rettv);
-static void f_inputdialog(typval_T *argvars, typval_T *rettv);
-static void f_inputlist(typval_T *argvars, typval_T *rettv);
-static void f_inputrestore(typval_T *argvars, typval_T *rettv);
-static void f_inputsave(typval_T *argvars, typval_T *rettv);
-static void f_inputsecret(typval_T *argvars, typval_T *rettv);
-static void f_insert(typval_T *argvars, typval_T *rettv);
-static void f_invert(typval_T *argvars, typval_T *rettv);
-static void f_isdirectory(typval_T *argvars, typval_T *rettv);
-static void f_islocked(typval_T *argvars, typval_T *rettv);
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
-static void f_isnan(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_items(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_JOB_CHANNEL
-static void f_job_getchannel(typval_T *argvars, typval_T *rettv);
-static void f_job_info(typval_T *argvars, typval_T *rettv);
-static void f_job_setoptions(typval_T *argvars, typval_T *rettv);
-static void f_job_start(typval_T *argvars, typval_T *rettv);
-static void f_job_stop(typval_T *argvars, typval_T *rettv);
-static void f_job_status(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_join(typval_T *argvars, typval_T *rettv);
-static void f_js_decode(typval_T *argvars, typval_T *rettv);
-static void f_js_encode(typval_T *argvars, typval_T *rettv);
-static void f_json_decode(typval_T *argvars, typval_T *rettv);
-static void f_json_encode(typval_T *argvars, typval_T *rettv);
-static void f_keys(typval_T *argvars, typval_T *rettv);
-static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv);
-static void f_len(typval_T *argvars, typval_T *rettv);
-static void f_libcall(typval_T *argvars, typval_T *rettv);
-static void f_libcallnr(typval_T *argvars, typval_T *rettv);
-static void f_line(typval_T *argvars, typval_T *rettv);
-static void f_line2byte(typval_T *argvars, typval_T *rettv);
-static void f_lispindent(typval_T *argvars, typval_T *rettv);
-static void f_localtime(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_log(typval_T *argvars, typval_T *rettv);
-static void f_log10(typval_T *argvars, typval_T *rettv);
-#endif
-#ifdef FEAT_LUA
-static void f_luaeval(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_map(typval_T *argvars, typval_T *rettv);
-static void f_maparg(typval_T *argvars, typval_T *rettv);
-static void f_mapcheck(typval_T *argvars, typval_T *rettv);
-static void f_match(typval_T *argvars, typval_T *rettv);
-static void f_matchadd(typval_T *argvars, typval_T *rettv);
-static void f_matchaddpos(typval_T *argvars, typval_T *rettv);
-static void f_matcharg(typval_T *argvars, typval_T *rettv);
-static void f_matchdelete(typval_T *argvars, typval_T *rettv);
-static void f_matchend(typval_T *argvars, typval_T *rettv);
-static void f_matchlist(typval_T *argvars, typval_T *rettv);
-static void f_matchstr(typval_T *argvars, typval_T *rettv);
-static void f_matchstrpos(typval_T *argvars, typval_T *rettv);
-static void f_max(typval_T *argvars, typval_T *rettv);
-static void f_min(typval_T *argvars, typval_T *rettv);
-#ifdef vim_mkdir
-static void f_mkdir(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_mode(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_MZSCHEME
-static void f_mzeval(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_nextnonblank(typval_T *argvars, typval_T *rettv);
-static void f_nr2char(typval_T *argvars, typval_T *rettv);
-static void f_or(typval_T *argvars, typval_T *rettv);
-static void f_pathshorten(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_PERL
-static void f_perleval(typval_T *argvars, typval_T *rettv);
-#endif
-#ifdef FEAT_FLOAT
-static void f_pow(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_prevnonblank(typval_T *argvars, typval_T *rettv);
-static void f_printf(typval_T *argvars, typval_T *rettv);
-static void f_pumvisible(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_PYTHON3
-static void f_py3eval(typval_T *argvars, typval_T *rettv);
-#endif
-#ifdef FEAT_PYTHON
-static void f_pyeval(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_range(typval_T *argvars, typval_T *rettv);
-static void f_readfile(typval_T *argvars, typval_T *rettv);
-static void f_reltime(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_reltimefloat(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_reltimestr(typval_T *argvars, typval_T *rettv);
-static void f_remote_expr(typval_T *argvars, typval_T *rettv);
-static void f_remote_foreground(typval_T *argvars, typval_T *rettv);
-static void f_remote_peek(typval_T *argvars, typval_T *rettv);
-static void f_remote_read(typval_T *argvars, typval_T *rettv);
-static void f_remote_send(typval_T *argvars, typval_T *rettv);
-static void f_remove(typval_T *argvars, typval_T *rettv);
-static void f_rename(typval_T *argvars, typval_T *rettv);
-static void f_repeat(typval_T *argvars, typval_T *rettv);
-static void f_resolve(typval_T *argvars, typval_T *rettv);
-static void f_reverse(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_round(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_screenattr(typval_T *argvars, typval_T *rettv);
-static void f_screenchar(typval_T *argvars, typval_T *rettv);
-static void f_screencol(typval_T *argvars, typval_T *rettv);
-static void f_screenrow(typval_T *argvars, typval_T *rettv);
-static void f_search(typval_T *argvars, typval_T *rettv);
-static void f_searchdecl(typval_T *argvars, typval_T *rettv);
-static void f_searchpair(typval_T *argvars, typval_T *rettv);
-static void f_searchpairpos(typval_T *argvars, typval_T *rettv);
-static void f_searchpos(typval_T *argvars, typval_T *rettv);
-static void f_server2client(typval_T *argvars, typval_T *rettv);
-static void f_serverlist(typval_T *argvars, typval_T *rettv);
-static void f_setbufvar(typval_T *argvars, typval_T *rettv);
-static void f_setcharsearch(typval_T *argvars, typval_T *rettv);
-static void f_setcmdpos(typval_T *argvars, typval_T *rettv);
-static void f_setfperm(typval_T *argvars, typval_T *rettv);
-static void f_setline(typval_T *argvars, typval_T *rettv);
-static void f_setloclist(typval_T *argvars, typval_T *rettv);
-static void f_setmatches(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_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_setwinvar(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_CRYPT
-static void f_sha256(typval_T *argvars, typval_T *rettv);
-#endif /* FEAT_CRYPT */
-static void f_shellescape(typval_T *argvars, typval_T *rettv);
-static void f_shiftwidth(typval_T *argvars, typval_T *rettv);
-static void f_simplify(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_sin(typval_T *argvars, typval_T *rettv);
-static void f_sinh(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_sort(typval_T *argvars, typval_T *rettv);
-static void f_soundfold(typval_T *argvars, typval_T *rettv);
-static void f_spellbadword(typval_T *argvars, typval_T *rettv);
-static void f_spellsuggest(typval_T *argvars, typval_T *rettv);
-static void f_split(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_sqrt(typval_T *argvars, typval_T *rettv);
-static void f_str2float(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_str2nr(typval_T *argvars, typval_T *rettv);
-static void f_strchars(typval_T *argvars, typval_T *rettv);
-#ifdef HAVE_STRFTIME
-static void f_strftime(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_strgetchar(typval_T *argvars, typval_T *rettv);
-static void f_stridx(typval_T *argvars, typval_T *rettv);
-static void f_string(typval_T *argvars, typval_T *rettv);
-static void f_strlen(typval_T *argvars, typval_T *rettv);
-static void f_strcharpart(typval_T *argvars, typval_T *rettv);
-static void f_strpart(typval_T *argvars, typval_T *rettv);
-static void f_strridx(typval_T *argvars, typval_T *rettv);
-static void f_strtrans(typval_T *argvars, typval_T *rettv);
-static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv);
-static void f_strwidth(typval_T *argvars, typval_T *rettv);
-static void f_submatch(typval_T *argvars, typval_T *rettv);
-static void f_substitute(typval_T *argvars, typval_T *rettv);
-static void f_synID(typval_T *argvars, typval_T *rettv);
-static void f_synIDattr(typval_T *argvars, typval_T *rettv);
-static void f_synIDtrans(typval_T *argvars, typval_T *rettv);
-static void f_synstack(typval_T *argvars, typval_T *rettv);
-static void f_synconcealed(typval_T *argvars, typval_T *rettv);
-static void f_system(typval_T *argvars, typval_T *rettv);
-static void f_systemlist(typval_T *argvars, typval_T *rettv);
-static void f_tabpagebuflist(typval_T *argvars, typval_T *rettv);
-static void f_tabpagenr(typval_T *argvars, typval_T *rettv);
-static void f_tabpagewinnr(typval_T *argvars, typval_T *rettv);
-static void f_taglist(typval_T *argvars, typval_T *rettv);
-static void f_tagfiles(typval_T *argvars, typval_T *rettv);
-static void f_tempname(typval_T *argvars, typval_T *rettv);
-static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
-static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
-static void f_test_disable_char_avail(typval_T *argvars, typval_T *rettv);
-static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_JOB_CHANNEL
-static void f_test_null_channel(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_test_null_dict(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_JOB_CHANNEL
-static void f_test_null_job(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_test_null_list(typval_T *argvars, typval_T *rettv);
-static void f_test_null_partial(typval_T *argvars, typval_T *rettv);
-static void f_test_null_string(typval_T *argvars, typval_T *rettv);
-static void f_test_settime(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_tan(typval_T *argvars, typval_T *rettv);
-static void f_tanh(typval_T *argvars, typval_T *rettv);
-#endif
-#ifdef FEAT_TIMERS
-static void f_timer_start(typval_T *argvars, typval_T *rettv);
-static void f_timer_stop(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_tolower(typval_T *argvars, typval_T *rettv);
-static void f_toupper(typval_T *argvars, typval_T *rettv);
-static void f_tr(typval_T *argvars, typval_T *rettv);
-#ifdef FEAT_FLOAT
-static void f_trunc(typval_T *argvars, typval_T *rettv);
-#endif
-static void f_type(typval_T *argvars, typval_T *rettv);
-static void f_undofile(typval_T *argvars, typval_T *rettv);
-static void f_undotree(typval_T *argvars, typval_T *rettv);
-static void f_uniq(typval_T *argvars, typval_T *rettv);
-static void f_values(typval_T *argvars, typval_T *rettv);
-static void f_virtcol(typval_T *argvars, typval_T *rettv);
-static void f_visualmode(typval_T *argvars, typval_T *rettv);
-static void f_wildmenumode(typval_T *argvars, typval_T *rettv);
-static void f_win_findbuf(typval_T *argvars, typval_T *rettv);
-static void f_win_getid(typval_T *argvars, typval_T *rettv);
-static void f_win_gotoid(typval_T *argvars, typval_T *rettv);
-static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv);
-static void f_win_id2win(typval_T *argvars, typval_T *rettv);
-static void f_winbufnr(typval_T *argvars, typval_T *rettv);
-static void f_wincol(typval_T *argvars, typval_T *rettv);
-static void f_winheight(typval_T *argvars, typval_T *rettv);
-static void f_winline(typval_T *argvars, typval_T *rettv);
-static void f_winnr(typval_T *argvars, typval_T *rettv);
-static void f_winrestcmd(typval_T *argvars, typval_T *rettv);
-static void f_winrestview(typval_T *argvars, typval_T *rettv);
-static void f_winsaveview(typval_T *argvars, typval_T *rettv);
-static void f_winwidth(typval_T *argvars, typval_T *rettv);
-static void f_writefile(typval_T *argvars, typval_T *rettv);
-static void f_wordcount(typval_T *argvars, typval_T *rettv);
-static void f_xor(typval_T *argvars, typval_T *rettv);
-
-static int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp);
-static pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum);
+
static int get_env_len(char_u **arg);
-static int get_name_len(char_u **arg, char_u **alias, int evaluate, int verbose);
static char_u * make_expanded_name(char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end);
-static int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
static typval_T *alloc_string_tv(char_u *string);
-static void init_tv(typval_T *varp);
-#ifdef FEAT_FLOAT
-static float_T get_tv_float(typval_T *varp);
-#endif
-static linenr_T get_tv_lnum(typval_T *argvars);
-static linenr_T get_tv_lnum_buf(typval_T *argvars, buf_T *buf);
-static dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);
static hashtab_T *find_var_ht(char_u *name, char_u **varname);
static void delete_var(hashtab_T *ht, hashitem_T *hi);
static void list_one_var(dictitem_T *v, char_u *prefix, int *first);
static void list_one_var_a(char_u *prefix, char_u *name, int type, char_u *string, int *first);
-static void set_var(char_u *name, typval_T *varp, int copy);
-static int var_check_fixed(int flags, char_u *name, int use_gettext);
static char_u *find_option_end(char_u **arg, int *opt_flags);
-static win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp);
-static win_T *find_tabwin(typval_T *wvp, typval_T *tvp);
-static void getwinvar(typval_T *argvars, typval_T *rettv, int off);
-static int searchpair_cmn(typval_T *argvars, pos_T *match_pos);
-static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp);
-static void setwinvar(typval_T *argvars, typval_T *rettv, int off);
-static int write_list(FILE *fd, list_T *list, int binary);
-static void get_cmd_output_as_rettv(typval_T *argvars, typval_T *rettv, int retlist);
-
#ifdef EBCDIC
static int compare_func_name(const void *s1, const void *s2);
static void sortFunctions();
#endif
+/* for VIM_VERSION_ defines */
+#include "version.h"
+
/*
* Initialize the global and v: variables.
*/
@@ -2200,7 +1765,7 @@ ex_let_one(
/*
* If "arg" is equal to "b:changedtick" give an error and return TRUE.
*/
- static int
+ int
check_changedtick(char_u *arg)
{
if (STRNCMP(arg, "b:changedtick", 13) == 0 && !eval_isnamec(arg[13]))
@@ -3413,22 +2978,6 @@ item_lock(typval_T *tv, int deep, int lock)
--recurse;
}
-/*
- * Return TRUE if typeval "tv" is locked: Either that value is locked it