diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-08-26 10:27:42 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-08-26 10:27:42 -0300 |
commit | f94cd2201c3a8d341db448f2719dfb0ae4338adf (patch) | |
tree | 34f49a3e607098699b1f9e3af9358c062ec8425e /lstate.h | |
parent | fdbb243ff9980870c54676f3b2597b110ab82864 (diff) | |
download | lua-f94cd2201c3a8d341db448f2719dfb0ae4338adf.tar.gz lua-f94cd2201c3a8d341db448f2719dfb0ae4338adf.tar.bz2 lua-f94cd2201c3a8d341db448f2719dfb0ae4338adf.zip |
better control of call status through CallInfo
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.34 2008/06/26 19:42:45 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.35 2008/08/13 17:01:33 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 | */ |
@@ -82,16 +82,23 @@ typedef struct CallInfo { | |||
82 | StkId top; /* top for this function */ | 82 | StkId top; /* top for this function */ |
83 | const Instruction *savedpc; | 83 | const Instruction *savedpc; |
84 | short nresults; /* expected number of results from this function */ | 84 | short nresults; /* expected number of results from this function */ |
85 | lu_byte status; | 85 | lu_byte callstatus; |
86 | int tailcalls; /* number of tail calls lost under this entry */ | 86 | int tailcalls; /* number of tail calls lost under this entry */ |
87 | } CallInfo; | 87 | } CallInfo; |
88 | 88 | ||
89 | 89 | ||
90 | /* | ||
91 | ** Bits in CallInfo status | ||
92 | */ | ||
93 | #define CIST_LUA 1 /* call is running a Lua function */ | ||
94 | #define CIST_HOOKED 2 /* call is running a debug hook */ | ||
95 | #define CIST_REENTRY 4 /* call is running on same invocation of | ||
96 | luaV_execute of previous call */ | ||
97 | |||
90 | 98 | ||
91 | #define curr_func(L) (clvalue(L->ci->func)) | 99 | #define curr_func(L) (clvalue(L->ci->func)) |
92 | #define ci_func(ci) (clvalue((ci)->func)) | 100 | #define ci_func(ci) (clvalue((ci)->func)) |
93 | #define f_isLua(ci) (!ci_func(ci)->c.isC) | 101 | #define isLua(ci) ((ci)->callstatus & CIST_LUA) |
94 | #define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) | ||
95 | 102 | ||
96 | 103 | ||
97 | /* | 104 | /* |