diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-05 18:15:18 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-05 18:15:18 -0200 |
commit | 592a309177edc52847b1196969ad6d49ba21f4fb (patch) | |
tree | 06add977885c012ee22cc4f105785c435b6af353 /lstate.h | |
parent | 413fc7334bf8ceaea71417d73edef15c99d3a793 (diff) | |
download | lua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.gz lua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.bz2 lua-592a309177edc52847b1196969ad6d49ba21f4fb.zip |
tag system replaced by event tables
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.64 2001/11/06 21:40:51 roberto Exp $ | 2 | ** $Id: lstate.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -7,8 +7,10 @@ | |||
7 | #ifndef lstate_h | 7 | #ifndef lstate_h |
8 | #define lstate_h | 8 | #define lstate_h |
9 | 9 | ||
10 | #include "lobject.h" | ||
11 | #include "lua.h" | 10 | #include "lua.h" |
11 | |||
12 | #include "lobject.h" | ||
13 | #include "ltm.h" | ||
12 | #include "luadebug.h" | 14 | #include "luadebug.h" |
13 | 15 | ||
14 | 16 | ||
@@ -40,7 +42,24 @@ | |||
40 | 42 | ||
41 | 43 | ||
42 | struct lua_longjmp; /* defined in ldo.c */ | 44 | struct lua_longjmp; /* defined in ldo.c */ |
43 | struct TM; /* defined in ltm.h */ | 45 | |
46 | |||
47 | |||
48 | /* | ||
49 | ** reserve init of stack to store some global values | ||
50 | */ | ||
51 | |||
52 | /* default event table (both for tables and udata) */ | ||
53 | #define defaultet(L) (L->stack) | ||
54 | |||
55 | /* table of globals */ | ||
56 | #define gt(L) (L->stack + 1) | ||
57 | |||
58 | /* registry */ | ||
59 | #define registry(L) (L->stack + 2) | ||
60 | |||
61 | #define RESERVED_STACK_PREFIX 3 | ||
62 | |||
44 | 63 | ||
45 | 64 | ||
46 | typedef struct stringtable { | 65 | typedef struct stringtable { |
@@ -57,11 +76,6 @@ typedef struct global_State { | |||
57 | void *Mbuffer; /* global buffer */ | 76 | void *Mbuffer; /* global buffer */ |
58 | size_t Mbuffsize; /* size of Mbuffer */ | 77 | size_t Mbuffsize; /* size of Mbuffer */ |
59 | stringtable strt; /* hash table for strings */ | 78 | stringtable strt; /* hash table for strings */ |
60 | Table *type2tag; /* hash table from type names to tags */ | ||
61 | TObject registry; /* registry table */ | ||
62 | struct TM *TMtable; /* table for tag methods */ | ||
63 | int sizeTM; /* size of TMtable */ | ||
64 | int ntag; /* number of tags in TMtable */ | ||
65 | lu_mem GCthreshold; | 79 | lu_mem GCthreshold; |
66 | lu_mem nblocks; /* number of `bytes' currently allocated */ | 80 | lu_mem nblocks; /* number of `bytes' currently allocated */ |
67 | Proto *rootproto; /* list of all prototypes */ | 81 | Proto *rootproto; /* list of all prototypes */ |
@@ -69,6 +83,7 @@ typedef struct global_State { | |||
69 | Table *roottable; /* list of all tables */ | 83 | Table *roottable; /* list of all tables */ |
70 | Udata *rootudata; /* list of all userdata */ | 84 | Udata *rootudata; /* list of all userdata */ |
71 | UpVal *rootupval; /* list of closed up values */ | 85 | UpVal *rootupval; /* list of closed up values */ |
86 | TString *tmname[TM_N]; /* array with tag-method names */ | ||
72 | } global_State; | 87 | } global_State; |
73 | 88 | ||
74 | 89 | ||
@@ -80,10 +95,9 @@ struct lua_State { | |||
80 | StkId top; /* first free slot in the stack */ | 95 | StkId top; /* first free slot in the stack */ |
81 | CallInfo *ci; /* call info for current function */ | 96 | CallInfo *ci; /* call info for current function */ |
82 | StkId stack_last; /* last free slot in the stack */ | 97 | StkId stack_last; /* last free slot in the stack */ |
83 | TObject gt; /* table for globals */ | ||
84 | global_State *_G; | ||
85 | StkId stack; /* stack base */ | 98 | StkId stack; /* stack base */ |
86 | int stacksize; | 99 | int stacksize; |
100 | global_State *_G; | ||
87 | lua_Hook callhook; | 101 | lua_Hook callhook; |
88 | lua_Hook linehook; | 102 | lua_Hook linehook; |
89 | int allowhooks; | 103 | int allowhooks; |