diff options
Diffstat (limited to 'lstate.c')
| -rw-r--r-- | lstate.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lstate.c b/lstate.c new file mode 100644 index 00000000..653c4ba3 --- /dev/null +++ b/lstate.c | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* | ||
| 2 | ** $Id: $ | ||
| 3 | ** Global State | ||
| 4 | ** See Copyright Notice in lua.h | ||
| 5 | */ | ||
| 6 | |||
| 7 | |||
| 8 | #include "lbuiltin.h" | ||
| 9 | #include "ldo.h" | ||
| 10 | #include "llex.h" | ||
| 11 | #include "lmem.h" | ||
| 12 | #include "lstate.h" | ||
| 13 | #include "lstring.h" | ||
| 14 | #include "ltable.h" | ||
| 15 | #include "ltm.h" | ||
| 16 | |||
| 17 | |||
| 18 | LState *lua_state = NULL; | ||
| 19 | |||
| 20 | |||
| 21 | void lua_open (void) | ||
| 22 | { | ||
| 23 | if (lua_state) return; | ||
| 24 | lua_state = luaM_new(LState); | ||
| 25 | L->numCblocks = 0; | ||
| 26 | L->Cstack.base = 0; | ||
| 27 | L->Cstack.lua2C = 0; | ||
| 28 | L->Cstack.num = 0; | ||
| 29 | L->errorJmp = NULL; | ||
| 30 | L->rootproto.next = NULL; | ||
| 31 | L->rootproto.marked = 0; | ||
| 32 | L->rootcl.next = NULL; | ||
| 33 | L->rootcl.marked = 0; | ||
| 34 | L->rootglobal.next = NULL; | ||
| 35 | L->rootglobal.marked = 0; | ||
| 36 | L->roottable.next = NULL; | ||
| 37 | L->roottable.marked = 0; | ||
| 38 | L->refArray = NULL; | ||
| 39 | L->refSize = 0; | ||
| 40 | L->Mbuffsize = 0; | ||
| 41 | L->Mbuffer = NULL; | ||
| 42 | L->GCthreshold = GARBAGE_BLOCK; | ||
| 43 | L->nblocks = 0; | ||
| 44 | luaD_init(); | ||
| 45 | luaS_init(); | ||
| 46 | luaX_init(); | ||
| 47 | luaT_init(); | ||
| 48 | L->globalbag.ttype = LUA_T_ARRAY; | ||
| 49 | L->globalbag.value.a = luaH_new(0); | ||
| 50 | luaB_predefine(); | ||
| 51 | } | ||
| 52 | |||
