aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-11-19 15:31:19 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-11-19 15:31:19 -0200
commitb79ffdc4cef96ababe0cc068a6c11afdc71782eb (patch)
tree3900162dc96b809924852bcb5105109bc77eac6c /lstate.c
parent592a3f289b428e3ee5cc595a266607ad7f5d94ff (diff)
downloadlua-b79ffdc4cef96ababe0cc068a6c11afdc71782eb.tar.gz
lua-b79ffdc4cef96ababe0cc068a6c11afdc71782eb.tar.bz2
lua-b79ffdc4cef96ababe0cc068a6c11afdc71782eb.zip
global state for Lua interpreter
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c52
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
18LState *lua_state = NULL;
19
20
21void 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