aboutsummaryrefslogtreecommitdiff
path: root/luadebug.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-07-08 15:21:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-07-08 15:21:33 -0300
commit39b2d58c39fd0cd554b27ed071926bc439338964 (patch)
tree6855ede1b0e908439476e54396f94ae9ad275269 /luadebug.h
parentd2d24f09713cfecf59a7688c45a3863a35f09254 (diff)
downloadlua-39b2d58c39fd0cd554b27ed071926bc439338964.tar.gz
lua-39b2d58c39fd0cd554b27ed071926bc439338964.tar.bz2
lua-39b2d58c39fd0cd554b27ed071926bc439338964.zip
new interface for debug hooks
Diffstat (limited to 'luadebug.h')
-rw-r--r--luadebug.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/luadebug.h b/luadebug.h
index c7ea3da4..d8c82c2d 100644
--- a/luadebug.h
+++ b/luadebug.h
@@ -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
14typedef 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
14typedef struct lua_Debug lua_Debug; /* activation record */ 26typedef struct lua_Debug lua_Debug; /* activation record */
15 27
16typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); 28typedef 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);
21LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); 33LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
22LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); 34LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
23 35
24LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func); 36LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask);
25LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); 37LUA_API lua_Hook lua_gethook (lua_State *L);
38LUA_API int lua_gethookmask (lua_State *L);
26 39
27 40
28#define LUA_IDSIZE 60 41#define LUA_IDSIZE 60
29 42
30struct lua_Debug { 43struct 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' */