From 5f698f8b6f7e5fb18e0a7386dc506b0d5b538e6b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 25 Nov 2002 15:47:13 -0200 Subject: simpler interface to hooks + use of `int' to count hooks --- ldebug.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index 8dce4a8f..bf2a2fa9 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.137 2002/11/18 11:01:55 roberto Exp roberto $ +** $Id: ldebug.c,v 1.138 2002/11/21 15:16:04 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -60,17 +60,15 @@ void luaG_inithooks (lua_State *L) { /* ** this function can be called asynchronous (e.g. during a signal) */ -LUA_API int lua_sethook (lua_State *L, lua_Hook func, unsigned long mask) { - ls_count count = lua_getmaskcount(mask); +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { if (func == NULL || mask == 0) { /* turn off hooks? */ mask = 0; func = NULL; } - else if (count > 0) mask |= (1<hook = func; L->basehookcount = count; resethookcount(L); - L->hookmask = cast(lu_byte, mask & 0xf); + L->hookmask = cast(lu_byte, mask); L->hookinit = 0; return 1; } @@ -81,8 +79,13 @@ LUA_API lua_Hook lua_gethook (lua_State *L) { } -LUA_API unsigned long lua_gethookmask (lua_State *L) { - return L->hookmask | LUA_MASKCOUNT(L->basehookcount); +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; } -- cgit v1.2.3-55-g6feb