diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-06-30 12:53:21 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-06-30 12:53:21 -0300 |
commit | dbdc74dc5502c2e05e1c1e2ac894943f418c8431 (patch) | |
tree | e5f97ad48e953a4c435f6cff0b234b87e5449697 /ldo.h | |
parent | 6a0dace25a4b5b77f0fa6911de2ba26ef0fdff2c (diff) | |
download | lua-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.h | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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' */ |
53 | typedef void (*Pfunc) (lua_State *L, void *ud); | 65 | typedef 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, | |||
58 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, | 70 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, |
59 | int fTransfer, int nTransfer); | 71 | int fTransfer, int nTransfer); |
60 | LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); | 72 | LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); |
61 | LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nresults, | 73 | LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int retdel); |
62 | int delta1); | ||
63 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); | 74 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); |
64 | LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); | 75 | LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); |
65 | LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func); | 76 | LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func); |