diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-25 14:47:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-25 14:47:14 -0300 |
commit | 801aaf37b14a1fad5bb49c9a4200d25680152471 (patch) | |
tree | e3cc5cdebac6d503091f4ba16444f8ecfa8dfdb2 /ldo.c | |
parent | 00af2faae71e6388ee61ef18b2c5902a42e9bc27 (diff) | |
download | lua-801aaf37b14a1fad5bb49c9a4200d25680152471.tar.gz lua-801aaf37b14a1fad5bb49c9a4200d25680152471.tar.bz2 lua-801aaf37b14a1fad5bb49c9a4200d25680152471.zip |
simpler implementation for line information
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.164 2002/03/15 17:17:16 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.165 2002/03/20 12:52:32 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 | */ |
@@ -122,13 +122,13 @@ static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { | |||
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | void luaD_lineHook (lua_State *L, int line, lua_Hook linehook) { | 125 | void luaD_lineHook (lua_State *L, int line) { |
126 | if (L->allowhooks) { | 126 | if (L->allowhooks) { |
127 | lua_Debug ar; | 127 | lua_Debug ar; |
128 | ar.event = "line"; | 128 | ar.event = "line"; |
129 | ar.i_ci = L->ci - L->base_ci; | 129 | ar.i_ci = L->ci - L->base_ci; |
130 | ar.currentline = line; | 130 | ar.currentline = line; |
131 | dohook(L, &ar, linehook); | 131 | dohook(L, &ar, L->linehook); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
@@ -221,7 +221,6 @@ StkId luaD_precall (lua_State *L, StkId func) { | |||
221 | if (p->is_vararg) /* varargs? */ | 221 | if (p->is_vararg) /* varargs? */ |
222 | adjust_varargs(L, p->numparams); | 222 | adjust_varargs(L, p->numparams); |
223 | luaD_checkstack(L, p->maxstacksize); | 223 | luaD_checkstack(L, p->maxstacksize); |
224 | ci->line = 0; | ||
225 | ci->top = ci->base + p->maxstacksize; | 224 | ci->top = ci->base + p->maxstacksize; |
226 | while (L->top < ci->top) | 225 | while (L->top < ci->top) |
227 | setnilvalue(L->top++); | 226 | setnilvalue(L->top++); |
@@ -250,7 +249,7 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) { | |||
250 | luaD_callHook(L, L->callhook, "return"); | 249 | luaD_callHook(L, L->callhook, "return"); |
251 | firstResult = restorestack(L, fr); | 250 | firstResult = restorestack(L, fr); |
252 | } | 251 | } |
253 | res = L->ci->base - 1; /* func == final position of 1st result */ | 252 | res = L->ci->base - 1; /* res == final position of 1st result */ |
254 | L->ci--; | 253 | L->ci--; |
255 | /* move results to correct place */ | 254 | /* move results to correct place */ |
256 | while (wanted != 0 && firstResult < L->top) { | 255 | while (wanted != 0 && firstResult < L->top) { |