From dbdc74dc5502c2e05e1c1e2ac894943f418c8431 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Jun 2021 12:53:21 -0300 Subject: Simplification in the parameters of 'luaD_precall' The parameters 'nresults' and 'delta1', in 'luaD_precall', were never meaningful simultaneously. So, they were combined in a single parameter 'retdel'. --- ldo.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ldo.h') diff --git a/ldo.h b/ldo.h index 6edc4450..49fbb492 100644 --- a/ldo.h +++ b/ldo.h @@ -49,6 +49,18 @@ luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0) +/* +** 'luaD_precall' is used for regular calls, when it needs the +** number of results, and in tail calls, when it needs the 'delta' +** (correction of base for vararg functions). The argument 'retdel' +** codes these two options. A number of results is represented by +** itself, while a delta is represented by 'delta2retdel(delta)' +*/ +#define delta2retdel(d) (-(d) + LUA_MULTRET - 1) +#define retdel2delta(d) (-(d) + LUA_MULTRET - 1) +#define isdelta(rd) ((rd) < LUA_MULTRET) + + /* type of protected functions, to be ran by 'runprotected' */ typedef void (*Pfunc) (lua_State *L, void *ud); @@ -58,8 +70,7 @@ LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, int fTransfer, int nTransfer); LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); -LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nresults, - int delta1); +LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int retdel); LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func); -- cgit v1.2.3-55-g6feb