diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-08 15:21:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-08 15:21:33 -0300 |
commit | 39b2d58c39fd0cd554b27ed071926bc439338964 (patch) | |
tree | 6855ede1b0e908439476e54396f94ae9ad275269 /luadebug.h | |
parent | d2d24f09713cfecf59a7688c45a3863a35f09254 (diff) | |
download | lua-39b2d58c39fd0cd554b27ed071926bc439338964.tar.gz lua-39b2d58c39fd0cd554b27ed071926bc439338964.tar.bz2 lua-39b2d58c39fd0cd554b27ed071926bc439338964.zip |
new interface for debug hooks
Diffstat (limited to 'luadebug.h')
-rw-r--r-- | luadebug.h | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luadebug.h,v 1.27 2002/04/04 17:21:31 roberto Exp roberto $ | 2 | ** $Id: luadebug.h,v 1.28 2002/06/18 17:10:43 roberto Exp roberto $ |
3 | ** Debugging API | 3 | ** Debugging API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -11,6 +11,18 @@ | |||
11 | 11 | ||
12 | #include "lua.h" | 12 | #include "lua.h" |
13 | 13 | ||
14 | typedef enum lua_Hookevent { | ||
15 | LUA_HOOKCALL, LUA_HOOKRET, LUA_HOOKLINE, LUA_HOOKCOUNT | ||
16 | } lua_Hookevent; | ||
17 | |||
18 | |||
19 | #define LUA_MASKCALL (2 << LUA_HOOKCALL) | ||
20 | #define LUA_MASKRET (2 << LUA_HOOKRET) | ||
21 | #define LUA_MASKLINE (2 << LUA_HOOKLINE) | ||
22 | #define lua_maskcount(count) ((count) << (LUA_HOOKCOUNT+1)) | ||
23 | #define lua_getmaskcount(mask) ((mask) >> (LUA_HOOKCOUNT+1)) | ||
24 | #define LUA_MASKCOUNT (lua_maskcount(1)) | ||
25 | |||
14 | typedef struct lua_Debug lua_Debug; /* activation record */ | 26 | typedef struct lua_Debug lua_Debug; /* activation record */ |
15 | 27 | ||
16 | typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); | 28 | typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); |
@@ -21,14 +33,15 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); | |||
21 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); | 33 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); |
22 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); | 34 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); |
23 | 35 | ||
24 | LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func); | 36 | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask); |
25 | LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); | 37 | LUA_API lua_Hook lua_gethook (lua_State *L); |
38 | LUA_API int lua_gethookmask (lua_State *L); | ||
26 | 39 | ||
27 | 40 | ||
28 | #define LUA_IDSIZE 60 | 41 | #define LUA_IDSIZE 60 |
29 | 42 | ||
30 | struct lua_Debug { | 43 | struct lua_Debug { |
31 | const char *event; /* `call', `return', `line' */ | 44 | lua_Hookevent event; |
32 | const char *name; /* (n) */ | 45 | const char *name; /* (n) */ |
33 | const char *namewhat; /* (n) `global', `local', `field', `method' */ | 46 | const char *namewhat; /* (n) `global', `local', `field', `method' */ |
34 | const char *what; /* (S) `Lua' function, `C' function, Lua `main' */ | 47 | const char *what; /* (S) `Lua' function, `C' function, Lua `main' */ |