diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-29 11:48:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-29 11:48:16 -0300 |
commit | 9d605982605db5ab8117b4cda71284bca2d25db8 (patch) | |
tree | 968b70b828f62ee945134424fbec866b4fc0f1bc /ldo.c | |
parent | 4e56c0d51412817a238f9de6453aaa16704a770d (diff) | |
download | lua-9d605982605db5ab8117b4cda71284bca2d25db8.tar.gz lua-9d605982605db5ab8117b4cda71284bca2d25db8.tar.bz2 lua-9d605982605db5ab8117b4cda71284bca2d25db8.zip |
better definitions for MULTRET
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.86 2000/08/28 17:57:04 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.87 2000/08/29 14:33:31 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -92,7 +92,7 @@ void luaD_adjusttop (lua_State *L, StkId base, int extra) { | |||
92 | /* | 92 | /* |
93 | ** Open a hole inside the stack at `pos' | 93 | ** Open a hole inside the stack at `pos' |
94 | */ | 94 | */ |
95 | void luaD_openstack (lua_State *L, StkId pos) { | 95 | static void luaD_openstack (lua_State *L, StkId pos) { |
96 | int i = L->top-pos; | 96 | int i = L->top-pos; |
97 | while (i--) pos[i+1] = pos[i]; | 97 | while (i--) pos[i+1] = pos[i]; |
98 | incr_top; | 98 | incr_top; |
@@ -160,7 +160,7 @@ void luaD_callTM (lua_State *L, const TObject *f, int nParams, int nResults) { | |||
160 | ** The arguments are on the stack, right after the function. | 160 | ** The arguments are on the stack, right after the function. |
161 | ** When returns, the results are on the stack, starting at the original | 161 | ** When returns, the results are on the stack, starting at the original |
162 | ** function position. | 162 | ** function position. |
163 | ** The number of results is nResults, unless nResults=MULT_RET. | 163 | ** The number of results is nResults, unless nResults=LUA_MULTRET. |
164 | */ | 164 | */ |
165 | void luaD_call (lua_State *L, StkId func, int nResults) { | 165 | void luaD_call (lua_State *L, StkId func, int nResults) { |
166 | StkId firstResult; | 166 | StkId firstResult; |
@@ -197,7 +197,7 @@ void luaD_call (lua_State *L, StkId func, int nResults) { | |||
197 | if (callhook) /* same hook that was active at entry */ | 197 | if (callhook) /* same hook that was active at entry */ |
198 | luaD_callHook(L, func, callhook, "return"); | 198 | luaD_callHook(L, func, callhook, "return"); |
199 | /* adjust the number of results */ | 199 | /* adjust the number of results */ |
200 | if (nResults == MULT_RET) | 200 | if (nResults == LUA_MULTRET) |
201 | nResults = L->top - firstResult; | 201 | nResults = L->top - firstResult; |
202 | else | 202 | else |
203 | luaD_adjusttop(L, firstResult, nResults); | 203 | luaD_adjusttop(L, firstResult, nResults); |
@@ -264,7 +264,6 @@ int lua_call (lua_State *L, int nargs, int nresults) { | |||
264 | StkId func = L->top - (nargs+1); /* function to be called */ | 264 | StkId func = L->top - (nargs+1); /* function to be called */ |
265 | struct lua_longjmp myErrorJmp; | 265 | struct lua_longjmp myErrorJmp; |
266 | chain_longjmp(L, &myErrorJmp); | 266 | chain_longjmp(L, &myErrorJmp); |
267 | if (nresults == LUA_MULTRET) nresults = MULT_RET; /* internal code */ | ||
268 | if (setjmp(myErrorJmp.b) == 0) { | 267 | if (setjmp(myErrorJmp.b) == 0) { |
269 | luaD_call(L, func, nresults); | 268 | luaD_call(L, func, nresults); |
270 | } | 269 | } |