diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-30 16:28:40 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-30 16:28:40 -0200 |
| commit | bcdbdaccc37aacdb8305f5012c2963e4cb343005 (patch) | |
| tree | c6e0ad8afa371840f49d92b3f1455f3e57cbccc6 /ldo.c | |
| parent | 5cafe5af02bfe2188ba0b69f5a7a8fe44c38ed24 (diff) | |
| download | lua-bcdbdaccc37aacdb8305f5012c2963e4cb343005.tar.gz lua-bcdbdaccc37aacdb8305f5012c2963e4cb343005.tar.bz2 lua-bcdbdaccc37aacdb8305f5012c2963e4cb343005.zip | |
more debug information (still with bug for tag methods...)
Diffstat (limited to 'ldo.c')
| -rw-r--r-- | ldo.c | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.61 1999/12/27 17:33:22 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.62 1999/12/29 16:31:15 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 | */ |
| @@ -114,8 +114,8 @@ void luaD_lineHook (lua_State *L, int line) { | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | 116 | ||
| 117 | static void luaD_callHook (lua_State *L, StkId func, lua_CHFunction callhook, | 117 | void luaD_callHook (lua_State *L, StkId func, lua_CHFunction callhook, |
| 118 | int isreturn) { | 118 | int isreturn) { |
| 119 | if (L->allowhooks) { | 119 | if (L->allowhooks) { |
| 120 | struct C_Lua_Stack oldCLS = L->Cstack; | 120 | struct C_Lua_Stack oldCLS = L->Cstack; |
| 121 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->top; | 121 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->top; |
| @@ -156,6 +156,8 @@ static StkId callC (lua_State *L, lua_CFunction f, StkId base) { | |||
| 156 | L->Cstack.num = numarg; | 156 | L->Cstack.num = numarg; |
| 157 | L->Cstack.lua2C = base; | 157 | L->Cstack.lua2C = base; |
| 158 | L->Cstack.base = L->top; | 158 | L->Cstack.base = L->top; |
| 159 | if (L->callhook) | ||
| 160 | luaD_callHook(L, base-1, L->callhook, 0); | ||
| 159 | (*f)(L); /* do the actual call */ | 161 | (*f)(L); /* do the actual call */ |
| 160 | firstResult = L->Cstack.base; | 162 | firstResult = L->Cstack.base; |
| 161 | L->Cstack = oldCLS; | 163 | L->Cstack = oldCLS; |
| @@ -194,8 +196,6 @@ void luaD_callTM (lua_State *L, const TObject *f, int nParams, int nResults) { | |||
| 194 | void luaD_call (lua_State *L, StkId func, int nResults) { | 196 | void luaD_call (lua_State *L, StkId func, int nResults) { |
| 195 | StkId firstResult; | 197 | StkId firstResult; |
| 196 | lua_CHFunction callhook = L->callhook; | 198 | lua_CHFunction callhook = L->callhook; |
| 197 | if (callhook) | ||
| 198 | luaD_callHook(L, func, callhook, 0); | ||
| 199 | retry: /* for `function' tag method */ | 199 | retry: /* for `function' tag method */ |
| 200 | switch (ttype(func)) { | 200 | switch (ttype(func)) { |
| 201 | case LUA_T_CPROTO: | 201 | case LUA_T_CPROTO: |
| @@ -224,10 +224,10 @@ void luaD_call (lua_State *L, StkId func, int nResults) { | |||
| 224 | luaG_callerror(L, func); | 224 | luaG_callerror(L, func); |
| 225 | luaD_openstack(L, func); | 225 | luaD_openstack(L, func); |
| 226 | *func = *im; /* tag method is the new function to be called */ | 226 | *func = *im; /* tag method is the new function to be called */ |
| 227 | goto retry; /* retry the call (without calling callhook again) */ | 227 | goto retry; /* retry the call */ |
| 228 | } | 228 | } |
| 229 | } | 229 | } |
| 230 | if (callhook) /* same hook that was used at entry */ | 230 | if (callhook) /* same hook that was active at entry */ |
| 231 | luaD_callHook(L, NULL, callhook, 1); /* `return' hook */ | 231 | luaD_callHook(L, NULL, callhook, 1); /* `return' hook */ |
| 232 | /* adjust the number of results */ | 232 | /* adjust the number of results */ |
| 233 | if (nResults == MULT_RET) | 233 | if (nResults == MULT_RET) |
