diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-07 16:22:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-07 16:22:39 -0300 |
commit | 5016f43aa439662ca35a5d78e820c617c517f60a (patch) | |
tree | 167aabeccb5a2307c3de7d20542ecf7d99769d3c /lstate.h | |
parent | c1c100a0c04bc77623b32269f37df49e7a2457d2 (diff) | |
download | lua-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.h | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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 { | |||
87 | typedef struct CallInfo { | 87 | typedef 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 | ||