aboutsummaryrefslogtreecommitdiff
path: root/ldo.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-06-30 12:53:21 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-06-30 12:53:21 -0300
commitdbdc74dc5502c2e05e1c1e2ac894943f418c8431 (patch)
treee5f97ad48e953a4c435f6cff0b234b87e5449697 /ldo.h
parent6a0dace25a4b5b77f0fa6911de2ba26ef0fdff2c (diff)
downloadlua-dbdc74dc5502c2e05e1c1e2ac894943f418c8431.tar.gz
lua-dbdc74dc5502c2e05e1c1e2ac894943f418c8431.tar.bz2
lua-dbdc74dc5502c2e05e1c1e2ac894943f418c8431.zip
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'.
Diffstat (limited to 'ldo.h')
-rw-r--r--ldo.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/ldo.h b/ldo.h
index 6edc4450..49fbb492 100644
--- a/ldo.h
+++ b/ldo.h
@@ -49,6 +49,18 @@
49 luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0) 49 luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0)
50 50
51 51
52/*
53** 'luaD_precall' is used for regular calls, when it needs the
54** number of results, and in tail calls, when it needs the 'delta'
55** (correction of base for vararg functions). The argument 'retdel'
56** codes these two options. A number of results is represented by
57** itself, while a delta is represented by 'delta2retdel(delta)'
58*/
59#define delta2retdel(d) (-(d) + LUA_MULTRET - 1)
60#define retdel2delta(d) (-(d) + LUA_MULTRET - 1)
61#define isdelta(rd) ((rd) < LUA_MULTRET)
62
63
52/* type of protected functions, to be ran by 'runprotected' */ 64/* type of protected functions, to be ran by 'runprotected' */
53typedef void (*Pfunc) (lua_State *L, void *ud); 65typedef void (*Pfunc) (lua_State *L, void *ud);
54 66
@@ -58,8 +70,7 @@ LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
58LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, 70LUAI_FUNC void luaD_hook (lua_State *L, int event, int line,
59 int fTransfer, int nTransfer); 71 int fTransfer, int nTransfer);
60LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); 72LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci);
61LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nresults, 73LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int retdel);
62 int delta1);
63LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 74LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
64LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); 75LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults);
65LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func); 76LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func);