luadebug.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. ** $Id: luadebug.h,v 1.30 2002/07/08 20:22:08 roberto Exp $
  3. ** Debugging API
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef luadebug_h
  7. #define luadebug_h
  8. #include "lua.h"
  9. typedef enum lua_Hookevent {
  10. LUA_HOOKCALL, LUA_HOOKRET, LUA_HOOKLINE, LUA_HOOKCOUNT
  11. } lua_Hookevent;
  12. #define LUA_MASKCALL (2 << LUA_HOOKCALL)
  13. #define LUA_MASKRET (2 << LUA_HOOKRET)
  14. #define LUA_MASKLINE (2 << LUA_HOOKLINE)
  15. #define LUA_MASKCOUNT(count) ((count) << (LUA_HOOKCOUNT+1))
  16. #define lua_getmaskcount(mask) ((mask) >> (LUA_HOOKCOUNT+1))
  17. typedef struct lua_Debug lua_Debug; /* activation record */
  18. typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
  19. LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
  20. 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);
  22. LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
  23. LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask);
  24. LUA_API lua_Hook lua_gethook (lua_State *L);
  25. LUA_API int lua_gethookmask (lua_State *L);
  26. #define LUA_IDSIZE 60
  27. struct lua_Debug {
  28. lua_Hookevent event;
  29. const char *name; /* (n) */
  30. const char *namewhat; /* (n) `global', `local', `field', `method' */
  31. const char *what; /* (S) `Lua' function, `C' function, Lua `main' */
  32. const char *source; /* (S) */
  33. int currentline; /* (l) */
  34. int nups; /* (u) number of upvalues */
  35. int linedefined; /* (S) */
  36. char short_src[LUA_IDSIZE]; /* (S) */
  37. /* private part */
  38. int i_ci; /* active function */
  39. };
  40. #endif