aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/lstate.h b/lstate.h
index abd212ad..c7735b04 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.42 2000/11/24 17:39:56 roberto Exp roberto $ 2** $Id: lstate.h,v 1.43 2000/12/26 18:46:09 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*/
@@ -42,24 +42,17 @@ typedef struct stringtable {
42} stringtable; 42} stringtable;
43 43
44 44
45 45/*
46struct lua_State { 46** "global state", shared by all threads of this state
47 /* thread-specific state */ 47*/
48 StkId top; /* first free slot in the stack */ 48typedef struct global_State {
49 StkId stack; /* stack base */
50 StkId stack_last; /* last free slot in the stack */
51 int stacksize;
52 StkId Cbase; /* base for current C function */
53 struct lua_longjmp *errorJmp; /* current error recover point */
54 char *Mbuffer; /* global buffer */ 49 char *Mbuffer; /* global buffer */
55 size_t Mbuffsize; /* size of Mbuffer */ 50 size_t Mbuffsize; /* size of Mbuffer */
56 /* global state */
57 Proto *rootproto; /* list of all prototypes */ 51 Proto *rootproto; /* list of all prototypes */
58 Closure *rootcl; /* list of all closures */ 52 Closure *rootcl; /* list of all closures */
59 Hash *roottable; /* list of all tables */ 53 Hash *roottable; /* list of all tables */
60 stringtable strt; /* hash table for strings */ 54 stringtable strt; /* hash table for strings */
61 stringtable udt; /* hash table for udata */ 55 stringtable udt; /* hash table for udata */
62 Hash *gt; /* table for globals */
63 struct TM *TMtable; /* table for tag methods */ 56 struct TM *TMtable; /* table for tag methods */
64 int sizeTM; /* size of TMtable */ 57 int sizeTM; /* size of TMtable */
65 int ntag; /* number of tags in TMtable */ 58 int ntag; /* number of tags in TMtable */
@@ -69,11 +62,29 @@ struct lua_State {
69 int refFree; /* list of free positions in refArray */ 62 int refFree; /* list of free positions in refArray */
70 mem_int GCthreshold; 63 mem_int GCthreshold;
71 mem_int nblocks; /* number of `bytes' currently allocated */ 64 mem_int nblocks; /* number of `bytes' currently allocated */
65} global_State;
66
67
68/*
69** "per thread" state
70*/
71struct lua_State {
72 StkId top; /* first free slot in the stack */
73 StkId stack; /* stack base */
74 StkId stack_last; /* last free slot in the stack */
75 int stacksize;
76 StkId Cbase; /* base for current C function */
77 struct lua_longjmp *errorJmp; /* current error recover point */
78 Hash *gt; /* table for globals */
72 lua_Hook callhook; 79 lua_Hook callhook;
73 lua_Hook linehook; 80 lua_Hook linehook;
74 int allowhooks; 81 int allowhooks;
82 global_State *G;
75}; 83};
76 84
77 85
86#define G(L) (L->G)
87
88
78#endif 89#endif
79 90