diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-26 09:57:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-26 09:57:01 -0300 |
commit | 3dbf30540892b4b9c86e0cb663069cd478a0c900 (patch) | |
tree | 0a86ef692b04ce14b57734b0034452e32aadd610 /ldo.c | |
parent | 6d0ae11c576106b490a53215c3f227b65ace2776 (diff) | |
download | lua-3dbf30540892b4b9c86e0cb663069cd478a0c900.tar.gz lua-3dbf30540892b4b9c86e0cb663069cd478a0c900.tar.bz2 lua-3dbf30540892b4b9c86e0cb663069cd478a0c900.zip |
no more support for old-style varargs
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 22 |
1 files changed, 1 insertions, 21 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.55 2009/03/10 17:14:37 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.56 2009/03/23 14:26:12 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 | */ |
@@ -205,24 +205,9 @@ void luaD_callhook (lua_State *L, int event, int line) { | |||
205 | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { | 205 | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { |
206 | int i; | 206 | int i; |
207 | int nfixargs = p->numparams; | 207 | int nfixargs = p->numparams; |
208 | Table *htab = NULL; | ||
209 | StkId base, fixed; | 208 | StkId base, fixed; |
210 | for (; actual < nfixargs; ++actual) | 209 | for (; actual < nfixargs; ++actual) |
211 | setnilvalue(L->top++); | 210 | setnilvalue(L->top++); |
212 | #if defined(LUA_COMPAT_VARARG) | ||
213 | if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ | ||
214 | int nvar = actual - nfixargs; /* number of extra arguments */ | ||
215 | lua_assert(p->is_vararg & VARARG_HASARG); | ||
216 | luaC_checkGC(L); | ||
217 | htab = luaH_new(L); /* create `arg' table */ | ||
218 | sethvalue(L, L->top++, htab); | ||
219 | for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */ | ||
220 | setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i - 1); | ||
221 | /* store counter in field `n' */ | ||
222 | setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); | ||
223 | L->top--; | ||
224 | } | ||
225 | #endif | ||
226 | /* move fixed parameters to final position */ | 211 | /* move fixed parameters to final position */ |
227 | fixed = L->top - actual; /* first fixed argument */ | 212 | fixed = L->top - actual; /* first fixed argument */ |
228 | base = L->top; /* final position of first argument */ | 213 | base = L->top; /* final position of first argument */ |
@@ -230,11 +215,6 @@ static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { | |||
230 | setobjs2s(L, L->top++, fixed+i); | 215 | setobjs2s(L, L->top++, fixed+i); |
231 | setnilvalue(fixed+i); | 216 | setnilvalue(fixed+i); |
232 | } | 217 | } |
233 | /* add `arg' parameter */ | ||
234 | if (htab) { | ||
235 | sethvalue(L, L->top++, htab); | ||
236 | lua_assert(iswhite(obj2gco(htab))); | ||
237 | } | ||
238 | return base; | 218 | return base; |
239 | } | 219 | } |
240 | 220 | ||