aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-07 16:22:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-07 16:22:39 -0300
commit5016f43aa439662ca35a5d78e820c617c517f60a (patch)
tree167aabeccb5a2307c3de7d20542ecf7d99769d3c /lstate.h
parentc1c100a0c04bc77623b32269f37df49e7a2457d2 (diff)
downloadlua-5016f43aa439662ca35a5d78e820c617c517f60a.tar.gz
lua-5016f43aa439662ca35a5d78e820c617c517f60a.tar.bz2
lua-5016f43aa439662ca35a5d78e820c617c517f60a.zip
(much) cleaner way to control function states
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/lstate.h b/lstate.h
index bcd411a6..c5001f7b 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.91 2002/08/06 15:32:22 roberto Exp roberto $ 2** $Id: lstate.h,v 1.92 2002/08/06 18:01:50 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*/
@@ -87,10 +87,11 @@ typedef struct stringtable {
87typedef struct CallInfo { 87typedef struct CallInfo {
88 StkId base; /* base for called function */ 88 StkId base; /* base for called function */
89 StkId top; /* top for this function */ 89 StkId top; /* top for this function */
90 const Instruction **pc; /* points to `pc' variable in `luaV_execute' */ 90 int state; /* bit fields; see below */
91 union { 91 union {
92 struct { /* for Lua functions */ 92 struct { /* for Lua functions */
93 const Instruction *savedpc; 93 const Instruction *savedpc;
94 const Instruction **pc; /* points to `pc' variable in `luaV_execute' */
94 StkId *pb; /* points to `base' variable in `luaV_execute' */ 95 StkId *pb; /* points to `base' variable in `luaV_execute' */
95 } l; 96 } l;
96 struct { /* for C functions */ 97 struct { /* for C functions */
@@ -100,6 +101,17 @@ typedef struct CallInfo {
100} CallInfo; 101} CallInfo;
101 102
102 103
104/*
105** bit fields for `CallInfo.state'
106*/
107#define CI_C 1 /* 1 if function is a C function */
108/* 1 if (Lua) function has an active `luaV_execute' running it */
109#define CI_HASFRAME 2
110/* 1 if Lua function is calling another Lua function (and therefore its
111 `pc' is being used by the other, and therefore CI_SAVEDPC is 1 too) */
112#define CI_CALLING 4
113#define CI_SAVEDPC 8 /* 1 if `savedpc' is updated */
114
103 115
104#define ci_func(ci) (clvalue((ci)->base - 1)) 116#define ci_func(ci) (clvalue((ci)->base - 1))
105 117