lstate.c 926 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. ** $Id: lstate.c,v 1.1 1997/11/19 17:31:19 roberto Exp roberto $
  3. ** Global State
  4. ** See Copyright Notice in lua.h
  5. */
  6. #include "lbuiltin.h"
  7. #include "ldo.h"
  8. #include "llex.h"
  9. #include "lmem.h"
  10. #include "lstate.h"
  11. #include "lstring.h"
  12. #include "ltable.h"
  13. #include "ltm.h"
  14. LState *lua_state = NULL;
  15. void lua_open (void)
  16. {
  17. if (lua_state) return;
  18. lua_state = luaM_new(LState);
  19. L->numCblocks = 0;
  20. L->Cstack.base = 0;
  21. L->Cstack.lua2C = 0;
  22. L->Cstack.num = 0;
  23. L->errorJmp = NULL;
  24. L->rootproto.next = NULL;
  25. L->rootproto.marked = 0;
  26. L->rootcl.next = NULL;
  27. L->rootcl.marked = 0;
  28. L->rootglobal.next = NULL;
  29. L->rootglobal.marked = 0;
  30. L->roottable.next = NULL;
  31. L->roottable.marked = 0;
  32. L->refArray = NULL;
  33. L->refSize = 0;
  34. L->Mbuffsize = 0;
  35. L->Mbuffer = NULL;
  36. L->GCthreshold = GARBAGE_BLOCK;
  37. L->nblocks = 0;
  38. luaD_init();
  39. luaS_init();
  40. luaX_init();
  41. luaT_init();
  42. luaB_predefine();
  43. }