]> granicus.if.org Git - vim/commitdiff
patch 8.1.1989: the evalfunc.c file is still too big v8.1.1989
authorBram Moolenaar <Bram@vim.org>
Thu, 5 Sep 2019 20:33:28 +0000 (22:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 5 Sep 2019 20:33:28 +0000 (22:33 +0200)
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.

13 files changed:
src/diff.c
src/evalfunc.c
src/evalvars.c
src/ex_cmds2.c
src/filepath.c
src/if_cscope.c
src/proto/diff.pro
src/proto/evalfunc.pro
src/proto/evalvars.pro
src/proto/ex_cmds2.pro
src/proto/filepath.pro
src/proto/if_cscope.pro
src/version.c

index 4c0041d41832d29b3c9a4a3230dbd9df0030732e..01125aaf46cb48bfec829da213927e5755a086e5 100644 (file)
@@ -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
index 676f0376a49f9bb6b6a2f1720558fcbd4220fb34..c790913b3f23f69f33caa2e1d06c6c241170c797 100644 (file)
@@ -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);
@@ -2094,33 +2083,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)"
@@ -2321,75 +2283,6 @@ f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
     rettv->vval.v_number = did_filetype;
 }
 
-/*
- * "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
  */
@@ -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
@@ -9472,223 +9344,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
  */
index 9e1a24d3f0fb03c45cde6e7134dc7a2c350b23db..08a9cc2e1474c7a8b55cf65bfda21fb9723deeae 100644 (file)
@@ -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
index e2c87bd6f6f3b8680785eebf8fee72450e18a677..6eafd47e298a40ddd2952c3184b309351a49ede8 100644 (file)
@@ -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.
index 21cd767c53f6d55037d153ede281ff7bf9b7896d..811682e3755e4418e53cb35c44d68b2b7f650263 100644 (file)
@@ -1310,6 +1310,27 @@ f_mkdir(typval_T *argvars, typval_T *rettv)
     rettv->vval.v_number = vim_mkdir_emsg(dir, prot);
 }
 
+/*
+ * "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
  */
index 2cc25b7439d31ffbc50d3e1e065d854aafc91297..4f359ee55c09d10f3f8e979911418b83b746d3fa 100644 (file)
@@ -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
 
 
index 2ab6c546f857300aae791ad2c0a2069cd5860339..b18c59b2b1fe3e818fd93577a42e48a7faebdbd8 100644 (file)
@@ -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 : */
index 932193d3cb3876d9baf1bbc96655eb4865d759e9..e2d14670e10d0943fb5fa9fb8a818b644fc04471 100644 (file)
@@ -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 : */
index 998246dc37935ac06d8167c8f839976dc21fd5ac..691eec34923ca3ead79f70a7572f8a36cd68fe76 100644 (file)
@@ -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 : */
index e0fd3c6c7f9f1fee86e7c648037c88885bdf14ed..2ecda169f552f5ef7fe4bc4c599f6b4b6bf01f2b 100644 (file)
@@ -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);
index a3df123854b2ebe4559313b30b28ed4f2ef60d1e..405c8b5f650acd3c519149430ec52f1d45b0fce5 100644 (file)
@@ -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);
index f9919c4da7c40f8a373c81f74d0931d61ddedccf..0dcfc76c213b5534ebe6f991c53aa90a72d29b15 100644 (file)
@@ -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 : */
index 52e12ee7469866f3c5f783ad969e97ae6ac0fc8b..996c85b9cb8fc413b1852d25166b887a9c8495ac 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1989,
 /**/
     1988,
 /**/