summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-07-30 22:45:36 +0000
committerBram Moolenaar <Bram@vim.org>2005-07-30 22:45:36 +0000
commit25ceb2274727c22bed19fda2f64eeaea38518d80 (patch)
treed6f7fcee7fe4d11c9f58e7d54310e5c83b722823 /src/eval.c
parent5a8684e7821a35e371b845b60699df527a855a9f (diff)
downloadvim-git-25ceb2274727c22bed19fda2f64eeaea38518d80.tar.gz
updated for version 7.0120v7.0120
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c
index 4e202f404..596fa526c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1405,7 +1405,8 @@ call_vim_function(func, argc, argv, safe, rettv)
}
/*
- * Call some vimL function and return the result as a string
+ * Call vimL function "func" and return the result as a string.
+ * Returns NULL when calling the function fails.
* Uses argv[argc] for the function arguments.
*/
void *
@@ -1416,20 +1417,43 @@ call_func_retstr(func, argc, argv, safe)
int safe; /* use the sandbox */
{
typval_T rettv;
- char_u *retval = NULL;
+ char_u *retval;
if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
return NULL;
retval = vim_strsave(get_tv_string(&rettv));
-
clear_tv(&rettv);
+ return retval;
+}
+#if defined(FEAT_COMPL_FUNC) || defined(PROTO)
+/*
+ * Call vimL function "func" and return the result as a number.
+ * Returns -1 when calling the function fails.
+ * Uses argv[argc] for the function arguments.
+ */
+ long
+call_func_retnr(func, argc, argv, safe)
+ char_u *func;
+ int argc;
+ char_u **argv;
+ int safe; /* use the sandbox */
+{
+ typval_T rettv;
+ long retval;
+
+ if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
+ return -1;
+
+ retval = get_tv_number_chk(&rettv, NULL);
+ clear_tv(&rettv);
return retval;
}
+#endif
/*
- * Call some vimL function and return the result as a list
+ * Call vimL function "func" and return the result as a list
* Uses argv[argc] for the function arguments.
*/
void *