summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-05 22:33:28 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-05 22:33:28 +0200
commitaf7645d3733fdd3cd2df03ec7b653601d26969ef (patch)
tree1b3c3d1d0d6428c33026693a5086910cca8b3078
parent8d3b51084a5bdcd2ee9e31bc03cba0d16c43d428 (diff)
downloadvim-git-af7645d3733fdd3cd2df03ec7b653601d26969ef.tar.gz
patch 8.1.1989: the evalfunc.c file is still too bigv8.1.1989
Problem: The evalfunc.c file is still too big. Solution: Move f_pathshorten() to filepath.c. Move f_cscope_connection() to if_cscope.c. Move diff_ functions to diff.c. Move timer_ functions to ex_cmds2.c. move callback functions to evalvars.c.
-rw-r--r--src/diff.c75
-rw-r--r--src/evalfunc.c345
-rw-r--r--src/evalvars.c103
-rw-r--r--src/ex_cmds2.c119
-rw-r--r--src/filepath.c21
-rw-r--r--src/if_cscope.c32
-rw-r--r--src/proto/diff.pro2
-rw-r--r--src/proto/evalfunc.pro4
-rw-r--r--src/proto/evalvars.pro4
-rw-r--r--src/proto/ex_cmds2.pro5
-rw-r--r--src/proto/filepath.pro1
-rw-r--r--src/proto/if_cscope.pro2
-rw-r--r--src/version.c2
13 files changed, 359 insertions, 356 deletions
diff --git a/src/diff.c b/src/diff.c
index 4c0041d41..01125aaf4 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -3215,4 +3215,77 @@ xdiff_out(void *priv, mmbuffer_t *mb, int nbuf)
return 0;
}
-#endif /* FEAT_DIFF */
+#endif // FEAT_DIFF
+
+#if defined(FEAT_EVAL) || defined(PROTO)
+
+/*
+ * "diff_filler()" function
+ */
+ void
+f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+#ifdef FEAT_DIFF
+ rettv->vval.v_number = diff_check_fill(curwin, tv_get_lnum(argvars));
+#endif
+}
+
+/*
+ * "diff_hlID()" function
+ */
+ void
+f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+#ifdef FEAT_DIFF
+ linenr_T lnum = tv_get_lnum(argvars);
+ static linenr_T prev_lnum = 0;
+ static varnumber_T changedtick = 0;
+ static int fnum = 0;
+ static int change_start = 0;
+ static int change_end = 0;
+ static hlf_T hlID = (hlf_T)0;
+ int filler_lines;
+ int col;
+
+ if (lnum < 0) /* ignore type error in {lnum} arg */
+ lnum = 0;
+ if (lnum != prev_lnum
+ || changedtick != CHANGEDTICK(curbuf)
+ || fnum != curbuf->b_fnum)
+ {
+ /* New line, buffer, change: need to get the values. */
+ filler_lines = diff_check(curwin, lnum);
+ if (filler_lines < 0)
+ {
+ if (filler_lines == -1)
+ {
+ change_start = MAXCOL;
+ change_end = -1;
+ if (diff_find_change(curwin, lnum, &change_start, &change_end))
+ hlID = HLF_ADD; /* added line */
+ else
+ hlID = HLF_CHD; /* changed line */
+ }
+ else
+ hlID = HLF_ADD; /* added line */
+ }
+ else
+ hlID = (hlf_T)0;
+ prev_lnum = lnum;
+ changedtick = CHANGEDTICK(curbuf);
+ fnum = curbuf->b_fnum;
+ }
+
+ if (hlID == HLF_CHD || hlID == HLF_TXD)
+ {
+ col = tv_get_number(&argvars[1]) - 1; /* ignore type error in {col} */
+ if (col >= change_start && col <= change_end)
+ hlID = HLF_TXD; /* changed text */
+ else
+ hlID = HLF_CHD; /* changed line */
+ }
+ rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID;
+#endif
+}
+
+#endif
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 676f0376a..c790913b3 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -70,7 +70,6 @@ static void f_copy(typval_T *argvars, typval_T *rettv);
static void f_cos(typval_T *argvars, typval_T *rettv);
static void f_cosh(typval_T *argvars, typval_T *rettv);
#endif
-static void f_cscope_connection(typval_T *argvars, typval_T *rettv);
static void f_cursor(typval_T *argsvars, typval_T *rettv);
#ifdef MSWIN
static void f_debugbreak(typval_T *argvars, typval_T *rettv);
@@ -78,8 +77,6 @@ static void f_debugbreak(typval_T *argvars, typval_T *rettv);
static void f_deepcopy(typval_T *argvars, typval_T *rettv);
static void f_deletebufline(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_environ(typval_T *argvars, typval_T *rettv);
static void f_escape(typval_T *argvars, typval_T *rettv);
@@ -178,7 +175,6 @@ static void f_mzeval(typval_T *argvars, typval_T *rettv);
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
@@ -291,13 +287,6 @@ static void f_tagfiles(typval_T *argvars, typval_T *rettv);
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_info(typval_T *argvars, typval_T *rettv);
-static void f_timer_pause(typval_T *argvars, typval_T *rettv);
-static void f_timer_start(typval_T *argvars, typval_T *rettv);
-static void f_timer_stop(typval_T *argvars, typval_T *rettv);
-static void f_timer_stopall(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);
@@ -2095,33 +2084,6 @@ f_cosh(typval_T *argvars, typval_T *rettv)
#endif
/*
- * "cscope_connection([{num} , {dbpath} [, {prepend}]])" function
- *
- * Checks the existence of a cscope connection.
- */
- static void
-f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
-#ifdef FEAT_CSCOPE
- int num = 0;
- char_u *dbpath = NULL;
- char_u *prepend = NULL;
- char_u buf[NUMBUFLEN];
-
- if (argvars[0].v_type != VAR_UNKNOWN
- && argvars[1].v_type != VAR_UNKNOWN)
- {
- num = (int)tv_get_number(&argvars[0]);
- dbpath = tv_get_string(&argvars[1]);
- if (argvars[2].v_type != VAR_UNKNOWN)
- prepend = tv_get_string_buf(&argvars[2], buf);
- }
-
- rettv->vval.v_number = cs_connection(num, dbpath, prepend);
-#endif
-}
-
-/*
* "cursor(lnum, col)" function, or
* "cursor(list)"
*
@@ -2322,75 +2284,6 @@ f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
/*
- * "diff_filler()" function
- */
- static void
-f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
-#ifdef FEAT_DIFF
- rettv->vval.v_number = diff_check_fill(curwin, tv_get_lnum(argvars));
-#endif
-}
-
-/*
- * "diff_hlID()" function
- */
- static void
-f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
-#ifdef FEAT_DIFF
- linenr_T lnum = tv_get_lnum(argvars);
- static linenr_T prev_lnum = 0;
- static varnumber_T changedtick = 0;
- static int fnum = 0;
- static int change_start = 0;
- static int change_end = 0;
- static hlf_T hlID = (hlf_T)0;
- int filler_lines;
- int col;
-
- if (lnum < 0) /* ignore type error in {lnum} arg */
- lnum = 0;
- if (lnum != prev_lnum
- || changedtick != CHANGEDTICK(curbuf)
- || fnum != curbuf->b_fnum)
- {
- /* New line, buffer, change: need to get the values. */
- filler_lines = diff_check(curwin, lnum);
- if (filler_lines < 0)
- {
- if (filler_lines == -1)
- {
- change_start = MAXCOL;
- change_end = -1;
- if (diff_find_change(curwin, lnum, &change_start, &change_end))
- hlID = HLF_ADD; /* added line */
- else
- hlID = HLF_CHD; /* changed line */
- }
- else
- hlID = HLF_ADD; /* added line */
- }
- else
- hlID = (hlf_T)0;
- prev_lnum = lnum;
- changedtick = CHANGEDTICK(curbuf);
- fnum = curbuf->b_fnum;
- }
-
- if (hlID == HLF_CHD || hlID == HLF_TXD)
- {
- col = tv_get_number(&argvars[1]) - 1; /* ignore type error in {col} */
- if (col >= change_start && col <= change_end)
- hlID = HLF_TXD; /* changed text */
- else
- hlID = HLF_CHD; /* changed line */
- }
- rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID;
-#endif
-}
-
-/*
* "empty({expr})" function
*/
static void
@@ -6358,27 +6251,6 @@ f_or(typval_T *argvars, typval_T *rettv)
| tv_get_number_chk(&argvars[1], NULL);
}
-/*
- * "pathshorten()" function
- */
- static void
-f_pathshorten(typval_T *argvars, typval_T *rettv)
-{
- char_u *p;
-
- rettv->v_type = VAR_STRING;
- p = tv_get_string_chk(&argvars[0]);
- if (p == NULL)
- rettv->vval.v_string = NULL;
- else
- {
- p = vim_strsave(p);
- rettv->vval.v_string = p;
- if (p != NULL)
- shorten_dir(p);
- }
-}
-
#ifdef FEAT_PERL
/*
* "perleval()" function
@@ -9473,223 +9345,6 @@ f_tanh(typval_T *argvars, typval_T *rettv)
#endif
/*
- * Get a callback from "arg". It can be a Funcref or a function name.
- * When "arg" is zero return an empty string.
- * "cb_name" is not allocated.
- * "cb_name" is set to NULL for an invalid argument.
- */
- callback_T
-get_callback(typval_T *arg)
-{
- callback_T res;
-
- res.cb_free_name = FALSE;
- if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
- {
- res.cb_partial = arg->vval.v_partial;
- ++res.cb_partial->pt_refcount;
- res.cb_name = partial_name(res.cb_partial);
- }
- else
- {
- res.cb_partial = NULL;
- if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
- {
- // Note that we don't make a copy of the string.
- res.cb_name = arg->vval.v_string;
- func_ref(res.cb_name);
- }
- else if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
- {
- res.cb_name = (char_u *)"";
- }
- else
- {
- emsg(_("E921: Invalid callback argument"));
- res.cb_name = NULL;
- }
- }
- return res;
-}
-
-/*
- * Copy a callback into a typval_T.
- */
- void
-put_callback(callback_T *cb, typval_T *tv)
-{
- if (cb->cb_partial != NULL)
- {
- tv->v_type = VAR_PARTIAL;
- tv->vval.v_partial = cb->cb_partial;
- ++tv->vval.v_partial->pt_refcount;
- }
- else
- {
- tv->v_type = VAR_FUNC;
- tv->vval.v_string = vim_strsave(cb->cb_name);
- func_ref(cb->cb_name);
- }
-}
-
-/*
- * Make a copy of "src" into "dest", allocating the function name if needed,
- * without incrementing the refcount.
- */
- void
-set_callback(callback_T *dest, callback_T *src)
-{
- if (src->cb_partial == NULL)
- {
- // just a function name, make a copy
- dest->cb_name = vim_strsave(src->cb_name);
- dest->cb_free_name = TRUE;
- }
- else
- {
- // cb_name is a pointer into cb_partial
- dest->cb_name = src->cb_name;
- dest->cb_free_name = FALSE;
- }
- dest->cb_partial = src->cb_partial;
-}
-
-/*
- * Unref/free "callback" returned by get_callback() or set_callback().
- */
- void
-free_callback(callback_T *callback)
-{
- if (callback->cb_partial != NULL)
- {
- partial_unref(callback->cb_partial);
- callback->cb_partial = NULL;
- }
- else if (callback->cb_name != NULL)
- func_unref(callback->cb_name);
- if (callback->cb_free_name)
- {
- vim_free(callback->cb_name);
- callback->cb_free_name = FALSE;
- }
- callback->cb_name = NULL;
-}
-
-#ifdef FEAT_TIMERS
-/*
- * "timer_info([timer])" function
- */
- static void
-f_timer_info(typval_T *argvars, typval_T *rettv)
-{
- timer_T *timer = NULL;
-
- if (rettv_list_alloc(rettv) != OK)
- return;
- if (argvars[0].v_type != VAR_UNKNOWN)
- {
- if (argvars[0].v_type != VAR_NUMBER)
- emsg(_(e_number_exp));
- else
- {
- timer = find_timer((int)tv_get_number(&argvars[0]));
- if (timer != NULL)
- add_timer_info(rettv, timer);
- }
- }
- else
- add_timer_info_all(rettv);
-}
-
-/*
- * "timer_pause(timer, paused)" function
- */
- static void
-f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED)
-{
- timer_T *timer = NULL;
- int paused = (int)tv_get_number(&argvars[1]);
-
- if (argvars[0].v_type != VAR_NUMBER)
- emsg(_(e_number_exp));
- else
- {
- timer = find_timer((int)tv_get_number(&argvars[0]));
- if (timer != NULL)
- timer->tr_paused = paused;
- }
-}
-
-/*
- * "timer_start(time, callback [, options])" function
- */
- static void
-f_timer_start(typval_T *argvars, typval_T *rettv)
-{
- long msec = (long)tv_get_number(&argvars[0]);
- timer_T *timer;
- int repeat = 0;
- callback_T callback;
- dict_T *dict;
-
- rettv->vval.v_number = -1;
- if (check_secure())
- return;
- if (argvars[2].v_type != VAR_UNKNOWN)
- {
- if (argvars[2].v_type != VAR_DICT
- || (dict = argvars[2].vval.v_dict) == NULL)
- {
- semsg(_(e_invarg2), tv_get_string(&argvars[2]));
- return;
- }
- if (dict_find(dict, (char_u *)"repeat", -1) != NULL)
- repeat = dict_get_number(dict, (char_u *)"repeat");
- }
-
- callback = get_callback(&argvars[1]);
- if (callback.cb_name == NULL)
- return;
-
- timer = create_timer(msec, repeat);
- if (timer == NULL)
- free_callback(&callback);
- else
- {
- set_callback(&timer->tr_callback, &callback);
- rettv->vval.v_number = (varnumber_T)timer->tr_id;
- }
-}
-
-/*
- * "timer_stop(timer)" function
- */
- static void
-f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
-{
- timer_T *timer;
-
- if (argvars[0].v_type != VAR_NUMBER)
- {
- emsg(_(e_number_exp));
- return;
- }
- timer = find_timer((int)tv_get_number(&argvars[0]));
- if (timer != NULL)
- stop_timer(timer);
-}
-
-/*
- * "timer_stopall()" function
- */
- static void
-f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
- stop_all_timers();
-}
-#endif
-
-/*
* "tolower(string)" function
*/
static void
diff --git a/src/evalvars.c b/src/evalvars.c
index 9e1a24d3f..08a9cc2e1 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -3467,4 +3467,107 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED)
}
}
+/*
+ * Get a callback from "arg". It can be a Funcref or a function name.
+ * When "arg" is zero return an empty string.
+ * "cb_name" is not allocated.
+ * "cb_name" is set to NULL for an invalid argument.
+ */
+ callback_T
+get_callback(typval_T *arg)
+{
+ callback_T res;
+
+ res.cb_free_name = FALSE;
+ if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
+ {
+ res.cb_partial = arg->vval.v_partial;
+ ++res.cb_partial->pt_refcount;
+ res.cb_name = partial_name(res.cb_partial);
+ }
+ else
+ {
+ res.cb_partial = NULL;
+ if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
+ {
+ // Note that we don't make a copy of the string.
+ res.cb_name = arg->vval.v_string;
+ func_ref(res.cb_name);
+ }
+ else if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
+ {
+ res.cb_name = (char_u *)"";
+ }
+ else
+ {
+ emsg(_("E921: Invalid callback argument"));
+ res.cb_name = NULL;
+ }
+ }
+ return res;
+}
+
+/*
+ * Copy a callback into a typval_T.
+ */
+ void
+put_callback(callback_T *cb, typval_T *tv)
+{
+ if (cb->cb_partial != NULL)
+ {
+ tv->v_type = VAR_PARTIAL;
+ tv->vval.v_partial = cb->cb_partial;
+ ++tv->vval.v_partial->pt_refcount;
+ }
+ else
+ {
+ tv->v_type = VAR_FUNC;
+ tv->vval.v_string = vim_strsave(cb->cb_name);
+ func_ref(cb->cb_name);
+ }
+}
+
+/*
+ * Make a copy of "src" into "dest", allocating the function name if needed,
+ * without incrementing the refcount.
+ */
+ void
+set_callback(callback_T *dest, callback_T *src)
+{
+ if (src->cb_partial == NULL)
+ {
+ // just a function name, make a copy
+ dest->cb_name = vim_strsave(src->cb_name);
+ dest->cb_free_name = TRUE;
+ }
+ else
+ {
+ // cb_name is a pointer into cb_partial
+ dest->cb_name = src->cb_name;
+ dest->cb_free_name = FALSE;
+ }
+ dest->cb_partial = src->cb_partial;
+}
+
+/*
+ * Unref/free "callback" returned by get_callback() or set_callback().
+ */
+ void
+free_callback(callback_T *callback)
+{
+ if (callback->cb_partial != NULL)
+ {
+ partial_unref(callback->cb_partial);
+ callback->cb_partial = NULL;
+ }
+ else if (callback->cb_name != NULL)
+ func_unref(callback->cb_name);
+ if (callback->cb_free_name)
+ {
+ vim_free(callback->cb_name);
+ callback->cb_free_name = FALSE;
+ }
+ callback->cb_name = NULL;
+}
+
#endif // FEAT_EVAL
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index e2c87bd6f..6eafd47e2 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -375,7 +375,7 @@ set_ref_in_timer(int copyID)
return abort;
}
-# if defined(EXITFREE) || defined(PROTO)
+# if defined(EXITFREE) || defined(PROTO)
void
timer_free_all()
{
@@ -388,10 +388,123 @@ timer_free_all()
free_timer(timer);
}
}
-# endif
# endif
-#endif
+/*
+ * "timer_info([timer])" function
+ */
+ void
+f_timer_info(typval_T *argvars, typval_T *rettv)
+{
+ timer_T *timer = NULL;
+
+ if (rettv_list_alloc(rettv) != OK)
+ return;
+ if (argvars[0].v_type != VAR_UNKNOWN)
+ {
+ if (argvars[0].v_type != VAR_NUMBER)
+ emsg(_(e_number_exp));
+ else
+ {
+ timer = find_timer((int)tv_get_number(&argvars[0]));
+ if (timer != NULL)
+ add_timer_info(rettv, timer);
+ }
+ }
+ else
+ add_timer_info_all(rettv);
+}
+
+/*
+ * "timer_pause(timer, paused)" function
+ */
+ void
+f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED)
+{
+ timer_T *timer = NULL;
+ int paused = (int)tv_get_number(&argvars[1]);
+
+ if (argvars[0].v_type != VAR_NUMBER)
+ emsg(_(e_number_exp));
+ else
+ {
+ timer = find_timer((int)tv_get_number(&argvars[0]));
+ if (timer != NULL)
+ timer->tr_paused = paused;
+ }
+}
+
+/*
+ * "timer_start(time, callback [, options])" function
+ */
+ void
+f_timer_start(typval_T *argvars, typval_T *rettv)
+{
+ long msec = (long)tv_get_number(&argvars[0]);
+ timer_T *timer;
+ int repeat = 0;
+ callback_T callback;
+ dict_T *dict;
+
+ rettv->vval.v_number = -1;
+ if (check_secure())
+ return;
+ if (argvars[2].v_type != VAR_UNKNOWN)
+ {
+ if (argvars[2].v_type != VAR_DICT
+ || (dict = argvars[2].vval.v_dict) == NULL)
+ {
+ semsg(_(e_invarg2), tv_get_string(&argvars[2]));
+ return;
+ }
+ if (dict_find(dict, (char_u *)"repeat", -1) != NULL)
+ repeat = dict_get_number(dict, (char_u *)"repeat");
+ }
+
+ callback = get_callback(&argvars[1]);
+ if (callback.cb_name == NULL)
+ return;
+
+ timer = create_timer(msec, repeat);
+ if (timer == NULL)
+ free_callback(&callback);
+ else
+ {
+ set_callback(&timer->tr_callback, &callback);
+ rettv->vval.v_number = (varnumber_T)timer->tr_id;
+ }
+}
+
+/*
+ * "timer_stop(timer)" function
+ */
+ void
+f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
+{
+ timer_T *timer;
+
+ if (argvars[0].v_type != VAR_NUMBER)
+ {
+ emsg(_(e_number_exp));
+ return;
+ }
+ timer = find_timer((int)tv_get_number(&argvars[0]));
+ if (timer != NULL)
+ stop_timer(timer);
+}
+
+/*
+ * "timer_stopall()" function
+ */
+ void
+f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ stop_all_timers();
+}
+
+# endif // FEAT_TIMERS
+
+#endif // FEAT_EVAL
/*
* If 'autowrite' option set, try to write the file.
diff --git a/src/filepath.c b/src/filepath.c
index 21cd767c5..811682e37 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1311,6 +1311,27 @@ f_mkdir(typval_T *argvars, typval_T *rettv)
}
/*
+ * "pathshorten()" function
+ */
+ void
+f_pathshorten(typval_T *argvars, typval_T *rettv)
+{
+ char_u *p;
+
+ rettv->v_type = VAR_STRING;
+ p = tv_get_string_chk(&argvars[0]);
+ if (p == NULL)
+ rettv->vval.v_string = NULL;
+ else
+ {
+ p = vim_strsave(p);
+ rettv->vval.v_string = p;
+ if (p != NULL)
+ shorten_dir(p);
+ }
+}
+
+/*
* "readdir()" function
*/
void
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 2cc25b743..4f359ee55 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -384,7 +384,7 @@ cs_print_tags(void)
* Note: All string comparisons are case sensitive!
*/
#if defined(FEAT_EVAL) || defined(PROTO)
- int
+ static int
cs_connection(int num, char_u *dbpath, char_u *ppath)
{
int i;
@@ -430,7 +430,35 @@ cs_connection(int num, char_u *dbpath, char_u *ppath)
}
return FALSE;
-} /* cs_connection */
+}
+
+/*
+ * "cscope_connection([{num} , {dbpath} [, {prepend}]])" function
+ *
+ * Checks the existence of a cscope connection.
+ */
+ void
+f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+#ifdef FEAT_CSCOPE
+ int num = 0;
+ char_u *dbpath = NULL;
+ char_u *prepend = NULL;
+ char_u buf[NUMBUFLEN];
+
+ if (argvars[0].v_type != VAR_UNKNOWN
+ && argvars[1].v_type != VAR_UNKNOWN)
+ {
+ num = (int)tv_get_number(&argvars[0]);
+ dbpath = tv_get_string(&argvars[1]);
+ if (argvars[2].v_type != VAR_UNKNOWN)
+ prepend = tv_get_string_buf(&argvars[2], buf);
+ }
+
+ rettv->vval.v_number = cs_connection(num, dbpath, prepend);
+#endif
+}
+
#endif
diff --git a/src/proto/diff.pro b/src/proto/diff.pro
index 2ab6c546f..b18c59b2b 100644
--- a/src/proto/diff.pro
+++ b/src/proto/diff.pro
@@ -27,4 +27,6 @@ int diff_mode_buf(buf_T *buf);
int diff_move_to(int dir, long count);
linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1);
linenr_T diff_lnum_win(linenr_T lnum, win_T *wp);
+void f_diff_filler(typval_T *argvars, typval_T *rettv);
+void f_diff_hlID(typval_T *argvars, typval_T *rettv);
/* vim: set ft=c : */
diff --git a/src/proto/evalfunc.pro b/src/proto/evalfunc.pro
index 932193d3c..e2d14670e 100644
--- a/src/proto/evalfunc.pro
+++ b/src/proto/evalfunc.pro
@@ -14,8 +14,4 @@ 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, typval_T *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit);
void f_string(typval_T *argvars, typval_T *rettv);
-callback_T get_callback(typval_T *arg);
-void put_callback(callback_T *cb, typval_T *tv);
-void set_callback(callback_T *dest, callback_T *src);
-void free_callback(callback_T *callback);
/* vim: set ft=c : */
diff --git a/src/proto/evalvars.pro b/src/proto/evalvars.pro
index 998246dc3..691eec349 100644
--- a/src/proto/evalvars.pro
+++ b/src/proto/evalvars.pro
@@ -77,4 +77,8 @@ 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);
void f_setbufvar(typval_T *argvars, typval_T *rettv);
+callback_T get_callback(typval_T *arg);
+void put_callback(callback_T *cb, typval_T *tv);
+void set_callback(callback_T *dest, callback_T *src);
+void free_callback(callback_T *callback);
/* vim: set ft=c : */
diff --git a/src/proto/ex_cmds2.pro b/src/proto/ex_cmds2.pro
index e0fd3c6c7..2ecda169f 100644
--- a/src/proto/ex_cmds2.pro
+++ b/src/proto/ex_cmds2.pro
@@ -9,6 +9,11 @@ void add_timer_info(typval_T *rettv, timer_T *timer);
void add_timer_info_all(typval_T *rettv);
int set_ref_in_timer(int copyID);
void timer_free_all(void);
+void f_timer_info(typval_T *argvars, typval_T *rettv);
+void f_timer_pause(typval_T *argvars, typval_T *rettv);
+void f_timer_start(typval_T *argvars, typval_T *rettv);
+void f_timer_stop(typval_T *argvars, typval_T *rettv);
+void f_timer_stopall(typval_T *argvars, typval_T *rettv);
int autowrite(buf_T *buf, int forceit);
void autowrite_all(void);
int check_changed(buf_T *buf, int flags);
diff --git a/src/proto/filepath.pro b/src/proto/filepath.pro
index a3df12385..405c8b5f6 100644
--- a/src/proto/filepath.pro
+++ b/src/proto/filepath.pro
@@ -20,6 +20,7 @@ void f_glob2regpat(typval_T *argvars, typval_T *rettv);
void f_globpath(typval_T *argvars, typval_T *rettv);
void f_isdirectory(typval_T *argvars, typval_T *rettv);
void f_mkdir(typval_T *argvars, typval_T *rettv);
+void f_pathshorten(typval_T *argvars, typval_T *rettv);
void f_readdir(typval_T *argvars, typval_T *rettv);
void f_readfile(typval_T *argvars, typval_T *rettv);
void f_resolve(typval_T *argvars, typval_T *rettv);
diff --git a/src/proto/if_cscope.pro b/src/proto/if_cscope.pro
index f9919c4da..0dcfc76c2 100644
--- a/src/proto/if_cscope.pro
+++ b/src/proto/if_cscope.pro
@@ -7,6 +7,6 @@ void ex_cstag(exarg_T *eap);
int cs_fgets(char_u *buf, int size);
void cs_free_tags(void);
void cs_print_tags(void);
-int cs_connection(int num, char_u *dbpath, char_u *ppath);
+void f_cscope_connection(typval_T *argvars, typval_T *rettv);
void cs_end(void);
/* vim: set ft=c : */
diff --git a/src/version.c b/src/version.c
index 52e12ee74..996c85b9c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1989,
+/**/
1988,
/**/
1987,