0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-06-01 13:28:35 +02:00
parent 7dd64a3e57
commit 3a97bb3f0f
13 changed files with 314 additions and 297 deletions

View File

@@ -1446,6 +1446,30 @@ func_call(
return r;
}
/*
* 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
*