diff options
Diffstat (limited to 'ldo.c')
| -rw-r--r-- | ldo.c | 17 |
1 files changed, 10 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.41 1999/03/11 18:59:19 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.42 1999/05/10 13:54:01 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -37,6 +37,12 @@ | |||
| 37 | #define STACK_UNIT 128 | 37 | #define STACK_UNIT 128 |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | #ifdef DEBUG | ||
| 41 | #undef STACK_UNIT | ||
| 42 | #define STACK_UNIT 2 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | |||
| 40 | void luaD_init (void) { | 46 | void luaD_init (void) { |
| 41 | L->stack.stack = luaM_newvector(STACK_UNIT, TObject); | 47 | L->stack.stack = luaM_newvector(STACK_UNIT, TObject); |
| 42 | L->stack.top = L->stack.stack; | 48 | L->stack.top = L->stack.stack; |
| @@ -80,16 +86,14 @@ void luaD_adjusttop (StkId newtop) { | |||
| 80 | /* | 86 | /* |
| 81 | ** Open a hole below "nelems" from the L->stack.top. | 87 | ** Open a hole below "nelems" from the L->stack.top. |
| 82 | */ | 88 | */ |
| 83 | void luaD_openstack (int nelems) | 89 | void luaD_openstack (int nelems) { |
| 84 | { | ||
| 85 | luaO_memup(L->stack.top-nelems+1, L->stack.top-nelems, | 90 | luaO_memup(L->stack.top-nelems+1, L->stack.top-nelems, |
| 86 | nelems*sizeof(TObject)); | 91 | nelems*sizeof(TObject)); |
| 87 | incr_top; | 92 | incr_top; |
| 88 | } | 93 | } |
| 89 | 94 | ||
| 90 | 95 | ||
| 91 | void luaD_lineHook (int line) | 96 | void luaD_lineHook (int line) { |
| 92 | { | ||
| 93 | struct C_Lua_Stack oldCLS = L->Cstack; | 97 | struct C_Lua_Stack oldCLS = L->Cstack; |
| 94 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; | 98 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; |
| 95 | L->Cstack.num = 0; | 99 | L->Cstack.num = 0; |
| @@ -99,8 +103,7 @@ void luaD_lineHook (int line) | |||
| 99 | } | 103 | } |
| 100 | 104 | ||
| 101 | 105 | ||
| 102 | void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn) | 106 | void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn) { |
| 103 | { | ||
| 104 | struct C_Lua_Stack oldCLS = L->Cstack; | 107 | struct C_Lua_Stack oldCLS = L->Cstack; |
| 105 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; | 108 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; |
| 106 | L->Cstack.num = 0; | 109 | L->Cstack.num = 0; |
