diff options
-rw-r--r-- | ldblib.c | 7 | ||||
-rw-r--r-- | ldo.c | 5 | ||||
-rw-r--r-- | lualib.h | 7 |
3 files changed, 14 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.58 2002/06/18 15:17:58 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.59 2002/06/18 17:10:43 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -126,12 +126,17 @@ static void hookf (lua_State *L, void *key) { | |||
126 | 126 | ||
127 | static void callf (lua_State *L, lua_Debug *ar) { | 127 | static void callf (lua_State *L, lua_Debug *ar) { |
128 | lua_pushstring(L, ar->event); | 128 | lua_pushstring(L, ar->event); |
129 | lua_assert(lua_getinfo(L, "lS", ar) && ar->currentline == -1); | ||
129 | hookf(L, (void *)&KEY_CALLHOOK); | 130 | hookf(L, (void *)&KEY_CALLHOOK); |
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||
133 | static void linef (lua_State *L, lua_Debug *ar) { | 134 | static void linef (lua_State *L, lua_Debug *ar) { |
134 | lua_pushnumber(L, ar->currentline); | 135 | lua_pushnumber(L, ar->currentline); |
136 | lua_assert((ar->currentline = ar->linedefined = -1, | ||
137 | lua_getinfo(L, "lS", ar) && | ||
138 | ar->currentline == lua_tonumber(L, -1) && | ||
139 | ar->linedefined >= 0)); | ||
135 | hookf(L, (void *)&KEY_LINEHOOK); | 140 | hookf(L, (void *)&KEY_LINEHOOK); |
136 | } | 141 | } |
137 | 142 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.180 2002/06/18 15:19:27 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.181 2002/06/18 17:10:43 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 | */ |
@@ -138,6 +138,7 @@ static void luaD_openstack (lua_State *L, StkId pos) { | |||
138 | static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { | 138 | static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { |
139 | ptrdiff_t top = savestack(L, L->top); | 139 | ptrdiff_t top = savestack(L, L->top); |
140 | ptrdiff_t ci_top = savestack(L, L->ci->top); | 140 | ptrdiff_t ci_top = savestack(L, L->ci->top); |
141 | ar->i_ci = L->ci - L->base_ci; | ||
141 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ | 142 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ |
142 | L->ci->top = L->top + LUA_MINSTACK; | 143 | L->ci->top = L->top + LUA_MINSTACK; |
143 | L->allowhooks = 0; /* cannot call hooks inside a hook */ | 144 | L->allowhooks = 0; /* cannot call hooks inside a hook */ |
@@ -155,7 +156,6 @@ void luaD_lineHook (lua_State *L, int line) { | |||
155 | if (L->allowhooks) { | 156 | if (L->allowhooks) { |
156 | lua_Debug ar; | 157 | lua_Debug ar; |
157 | ar.event = "line"; | 158 | ar.event = "line"; |
158 | ar.i_ci = L->ci - L->base_ci; | ||
159 | ar.currentline = line; | 159 | ar.currentline = line; |
160 | dohook(L, &ar, L->linehook); | 160 | dohook(L, &ar, L->linehook); |
161 | } | 161 | } |
@@ -166,7 +166,6 @@ static void luaD_callHook (lua_State *L, lua_Hook callhook, const char *event) { | |||
166 | if (L->allowhooks) { | 166 | if (L->allowhooks) { |
167 | lua_Debug ar; | 167 | lua_Debug ar; |
168 | ar.event = event; | 168 | ar.event = event; |
169 | ar.i_ci = L->ci - L->base_ci; | ||
170 | L->ci->pc = NULL; /* function is not active */ | 169 | L->ci->pc = NULL; /* function is not active */ |
171 | L->ci->top = L->ci->base; /* `top' may not have a valid value yet */ | 170 | L->ci->top = L->ci->base; /* `top' may not have a valid value yet */ |
172 | dohook(L, &ar, callhook); | 171 | dohook(L, &ar, callhook); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lualib.h,v 1.22 2002/04/09 20:19:06 roberto Exp roberto $ | 2 | ** $Id: lualib.h,v 1.23 2002/06/05 17:24:04 roberto Exp roberto $ |
3 | ** Lua standard libraries | 3 | ** Lua standard libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -38,4 +38,9 @@ LUALIB_API int lua_mathlibopen (lua_State *L); | |||
38 | LUALIB_API int lua_dblibopen (lua_State *L); | 38 | LUALIB_API int lua_dblibopen (lua_State *L); |
39 | 39 | ||
40 | 40 | ||
41 | /* to help testing the libraries */ | ||
42 | #ifndef lua_assert | ||
43 | #define lua_assert(c) /* empty */ | ||
44 | #endif | ||
45 | |||
41 | #endif | 46 | #endif |