diff options
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.137 2002/11/18 11:01:55 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.138 2002/11/21 15:16:04 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -60,17 +60,15 @@ void luaG_inithooks (lua_State *L) { | |||
60 | /* | 60 | /* |
61 | ** this function can be called asynchronous (e.g. during a signal) | 61 | ** this function can be called asynchronous (e.g. during a signal) |
62 | */ | 62 | */ |
63 | LUA_API int lua_sethook (lua_State *L, lua_Hook func, unsigned long mask) { | 63 | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { |
64 | ls_count count = lua_getmaskcount(mask); | ||
65 | if (func == NULL || mask == 0) { /* turn off hooks? */ | 64 | if (func == NULL || mask == 0) { /* turn off hooks? */ |
66 | mask = 0; | 65 | mask = 0; |
67 | func = NULL; | 66 | func = NULL; |
68 | } | 67 | } |
69 | else if (count > 0) mask |= (1<<LUA_HOOKCOUNT); | ||
70 | L->hook = func; | 68 | L->hook = func; |
71 | L->basehookcount = count; | 69 | L->basehookcount = count; |
72 | resethookcount(L); | 70 | resethookcount(L); |
73 | L->hookmask = cast(lu_byte, mask & 0xf); | 71 | L->hookmask = cast(lu_byte, mask); |
74 | L->hookinit = 0; | 72 | L->hookinit = 0; |
75 | return 1; | 73 | return 1; |
76 | } | 74 | } |
@@ -81,8 +79,13 @@ LUA_API lua_Hook lua_gethook (lua_State *L) { | |||
81 | } | 79 | } |
82 | 80 | ||
83 | 81 | ||
84 | LUA_API unsigned long lua_gethookmask (lua_State *L) { | 82 | LUA_API int lua_gethookmask (lua_State *L) { |
85 | return L->hookmask | LUA_MASKCOUNT(L->basehookcount); | 83 | return L->hookmask; |
84 | } | ||
85 | |||
86 | |||
87 | LUA_API int lua_gethookcount (lua_State *L) { | ||
88 | return L->basehookcount; | ||
86 | } | 89 | } |
87 | 90 | ||
88 | 91 | ||