diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-18 13:23:43 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-18 13:23:43 -0200 |
commit | c4ae00a3d107a27d80bd157a135ef115104f98f0 (patch) | |
tree | 604d3fea257fca821e1d8175d0eaaf1befd436b2 | |
parent | f4d3bc52f486bb1f0d32c6240faffb0e63bbb8fe (diff) | |
download | lua-c4ae00a3d107a27d80bd157a135ef115104f98f0.tar.gz lua-c4ae00a3d107a27d80bd157a135ef115104f98f0.tar.bz2 lua-c4ae00a3d107a27d80bd157a135ef115104f98f0.zip |
details
-rw-r--r-- | ldblib.c | 11 | ||||
-rw-r--r-- | lstate.h | 12 |
2 files changed, 14 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.70 2002/09/16 19:18:01 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.71 2002/11/14 15:41:38 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -167,8 +167,13 @@ static int sethook (lua_State *L) { | |||
167 | static int gethook (lua_State *L) { | 167 | static int gethook (lua_State *L) { |
168 | char buff[5]; | 168 | char buff[5]; |
169 | unsigned long mask = lua_gethookmask(L); | 169 | unsigned long mask = lua_gethookmask(L); |
170 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); | 170 | lua_Hook hook = lua_gethook(L); |
171 | lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ | 171 | if (hook != NULL && hook != hookf) /* external hook? */ |
172 | lua_pushliteral(L, "external hook"); | ||
173 | else { | ||
174 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); | ||
175 | lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ | ||
176 | } | ||
172 | lua_pushstring(L, unmakemask(mask, buff)); | 177 | lua_pushstring(L, unmakemask(mask, buff)); |
173 | lua_pushnumber(L, lua_getmaskcount(mask)); | 178 | lua_pushnumber(L, lua_getmaskcount(mask)); |
174 | return 3; | 179 | return 3; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.101 2002/11/13 11:31:39 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.102 2002/11/18 11:01:55 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -92,14 +92,14 @@ typedef struct CallInfo { | |||
92 | /* | 92 | /* |
93 | ** bit fields for `CallInfo.state' | 93 | ** bit fields for `CallInfo.state' |
94 | */ | 94 | */ |
95 | #define CI_C 1 /* 1 if function is a C function */ | 95 | #define CI_C (1<<0) /* 1 if function is a C function */ |
96 | /* 1 if (Lua) function has an active `luaV_execute' running it */ | 96 | /* 1 if (Lua) function has an active `luaV_execute' running it */ |
97 | #define CI_HASFRAME 2 | 97 | #define CI_HASFRAME (1<<1) |
98 | /* 1 if Lua function is calling another Lua function (and therefore its | 98 | /* 1 if Lua function is calling another Lua function (and therefore its |
99 | `pc' is being used by the other, and therefore CI_SAVEDPC is 1 too) */ | 99 | `pc' is being used by the other, and therefore CI_SAVEDPC is 1 too) */ |
100 | #define CI_CALLING 4 | 100 | #define CI_CALLING (1<<2) |
101 | #define CI_SAVEDPC 8 /* 1 if `savedpc' is updated */ | 101 | #define CI_SAVEDPC (1<<3) /* 1 if `savedpc' is updated */ |
102 | #define CI_YIELD 16 /* 1 if thread is suspended */ | 102 | #define CI_YIELD (1<<4) /* 1 if thread is suspended */ |
103 | 103 | ||
104 | 104 | ||
105 | #define ci_func(ci) (clvalue((ci)->base - 1)) | 105 | #define ci_func(ci) (clvalue((ci)->base - 1)) |