diff src/userfunc.c @ 16872:a836d122231a v8.1.1437

patch 8.1.1437: code to handle callbacks is duplicated commit https://github.com/vim/vim/commit/3a97bb3f0f8bd118ae23f1c97e55d84ff42eef20 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 1 13:28:35 2019 +0200 patch 8.1.1437: code to handle callbacks is duplicated Problem: Code to handle callbacks is duplicated. Solution: Add callback_T and functions to deal with it.
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Jun 2019 13:30:07 +0200
parents ce04ebdf26b8
children 8c794a694d66
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1447,6 +1447,30 @@ func_call(
 }
 
 /*
+ * Invoke call_func() with a callback.
+ */
+    int
+call_callback(
+    callback_T	*callback,
+    int		len,		// length of "name" or -1 to use strlen()
+    typval_T	*rettv,		// return value goes here
+    int		argcount,	// number of "argvars"
+    typval_T	*argvars,	// vars for arguments, must have "argcount"
+				// PLUS ONE elements!
+    int		(* argv_func)(int, typval_T *, int),
+				// function to fill in argvars
+    linenr_T	firstline,	// first line of range
+    linenr_T	lastline,	// last line of range
+    int		*doesrange,	// return: function handled range
+    int		evaluate,
+    dict_T	*selfdict)	// Dictionary for "self"
+{
+    return call_func(callback->cb_name, len, rettv, argcount, argvars,
+	    argv_func, firstline, lastline, doesrange, evaluate,
+	    callback->cb_partial, selfdict);
+}
+
+/*
  * Call a function with its resolved parameters
  *
  * "argv_func", when not NULL, can be used to fill in arguments only when the