From fa3113ffbf4455871baf1d1d9d48679a17e6f3e5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 12 Jun 2014 16:07:30 -0300 Subject: cleaner way to handle bit CIST_OAH (with auxiliar macros) --- lstate.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index b03ed4f8..47dddcec 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 2.105 2014/06/10 18:51:21 roberto Exp roberto $ +** $Id: lstate.h,v 2.106 2014/06/10 19:18:50 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -80,18 +80,21 @@ typedef struct CallInfo { /* ** Bits in CallInfo status */ -#define CIST_LUA (1<<0) /* call is running a Lua function */ -#define CIST_HOOKED (1<<1) /* call is running a debug hook */ -#define CIST_REENTRY (1<<2) /* call is running on same invocation of +#define CIST_OAH (1<<0) /* original value of 'allowhook' */ +#define CIST_LUA (1<<1) /* call is running a Lua function */ +#define CIST_HOOKED (1<<2) /* call is running a debug hook */ +#define CIST_REENTRY (1<<3) /* call is running on same invocation of luaV_execute of previous call */ -#define CIST_YPCALL (1<<3) /* call is a yieldable protected call */ -#define CIST_TAIL (1<<4) /* call was tail called */ -#define CIST_HOOKYIELD (1<<5) /* last hook called yielded */ -#define CIST_OAH (1<<6) /* original value of 'allowhook' */ - +#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ +#define CIST_TAIL (1<<5) /* call was tail called */ +#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ #define isLua(ci) ((ci)->callstatus & CIST_LUA) +/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ +#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) +#define getoah(st) ((st) & CIST_OAH) + /* ** `global state', shared by all threads of this state -- cgit v1.2.3-55-g6feb