From e5146fb01f1ccb40c2663e745feffbf642cbf862 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 16 Jul 2002 11:26:56 -0300 Subject: CallInfo has different fields for C functions and Lua functions --- lstate.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index ef47de36..5db528ff 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 1.87 2002/07/08 18:21:33 roberto Exp roberto $ +** $Id: lstate.h,v 1.88 2002/07/08 20:22:08 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -87,13 +87,22 @@ typedef struct stringtable { */ typedef struct CallInfo { StkId base; /* base for called function */ - const Instruction *savedpc; - StkId top; /* top for this function (when it's a Lua function) */ - const Instruction **pc; /* points to `pc' variable in `luaV_execute' */ - StkId *pb; /* points to `base' variable in `luaV_execute' */ - int yield_results; + StkId top; /* top for this function */ + const Instruction *savedpc; /* NULL means not a Lua function */ + union { + struct { /* for Lua functions */ + const Instruction **pc; /* points to `pc' variable in `luaV_execute' */ + StkId *pb; /* points to `base' variable in `luaV_execute' */ + } l; + struct { /* for C functions */ + int yield_results; + } c; + } u; } CallInfo; + +#define isLua(ci) ((ci)->savedpc != NULL) + #define ci_func(ci) (clvalue((ci)->base - 1)) -- cgit v1.2.3-55-g6feb