diff options
Diffstat (limited to 'ldo.c')
| -rw-r--r-- | ldo.c | 24 |
1 files changed, 12 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.15 2005/03/08 18:09:16 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.16 2005/03/08 20:10:05 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 | */ |
| @@ -43,7 +43,7 @@ | |||
| 43 | /* chain list of long jump buffers */ | 43 | /* chain list of long jump buffers */ |
| 44 | struct lua_longjmp { | 44 | struct lua_longjmp { |
| 45 | struct lua_longjmp *previous; | 45 | struct lua_longjmp *previous; |
| 46 | luac_jmpbuf b; | 46 | luai_jmpbuf b; |
| 47 | volatile int status; /* error code */ | 47 | volatile int status; /* error code */ |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| @@ -71,7 +71,7 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { | |||
| 71 | void luaD_throw (lua_State *L, int errcode) { | 71 | void luaD_throw (lua_State *L, int errcode) { |
| 72 | if (L->errorJmp) { | 72 | if (L->errorJmp) { |
| 73 | L->errorJmp->status = errcode; | 73 | L->errorJmp->status = errcode; |
| 74 | LUAC_THROW(L, L->errorJmp); | 74 | LUAI_THROW(L, L->errorJmp); |
| 75 | } | 75 | } |
| 76 | else { | 76 | else { |
| 77 | if (G(L)->panic) G(L)->panic(L); | 77 | if (G(L)->panic) G(L)->panic(L); |
| @@ -85,7 +85,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | |||
| 85 | lj.status = 0; | 85 | lj.status = 0; |
| 86 | lj.previous = L->errorJmp; /* chain new error handler */ | 86 | lj.previous = L->errorJmp; /* chain new error handler */ |
| 87 | L->errorJmp = &lj; | 87 | L->errorJmp = &lj; |
| 88 | LUAC_TRY(L, &lj, | 88 | LUAI_TRY(L, &lj, |
| 89 | (*f)(L, ud); | 89 | (*f)(L, ud); |
| 90 | ); | 90 | ); |
| 91 | L->errorJmp = lj.previous; /* restore old error handler */ | 91 | L->errorJmp = lj.previous; /* restore old error handler */ |
| @@ -95,10 +95,10 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | |||
| 95 | 95 | ||
| 96 | static void restore_stack_limit (lua_State *L) { | 96 | static void restore_stack_limit (lua_State *L) { |
| 97 | lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); | 97 | lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); |
| 98 | if (L->size_ci > LUAC_MAXCALLS) { /* there was an overflow? */ | 98 | if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ |
| 99 | int inuse = (L->ci - L->base_ci); | 99 | int inuse = (L->ci - L->base_ci); |
| 100 | if (inuse + 1 < LUAC_MAXCALLS) /* can `undo' overflow? */ | 100 | if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ |
| 101 | luaD_reallocCI(L, LUAC_MAXCALLS); | 101 | luaD_reallocCI(L, LUAI_MAXCALLS); |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | 104 | ||
| @@ -149,11 +149,11 @@ void luaD_growstack (lua_State *L, int n) { | |||
| 149 | 149 | ||
| 150 | 150 | ||
| 151 | static CallInfo *growCI (lua_State *L) { | 151 | static CallInfo *growCI (lua_State *L) { |
| 152 | if (L->size_ci > LUAC_MAXCALLS) /* overflow while handling overflow? */ | 152 | if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ |
| 153 | luaD_throw(L, LUA_ERRERR); | 153 | luaD_throw(L, LUA_ERRERR); |
| 154 | else { | 154 | else { |
| 155 | luaD_reallocCI(L, 2*L->size_ci); | 155 | luaD_reallocCI(L, 2*L->size_ci); |
| 156 | if (L->size_ci > LUAC_MAXCALLS) | 156 | if (L->size_ci > LUAI_MAXCALLS) |
| 157 | luaG_runerror(L, "stack overflow"); | 157 | luaG_runerror(L, "stack overflow"); |
| 158 | } | 158 | } |
| 159 | return ++L->ci; | 159 | return ++L->ci; |
| @@ -340,10 +340,10 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) { | |||
| 340 | ** function position. | 340 | ** function position. |
| 341 | */ | 341 | */ |
| 342 | void luaD_call (lua_State *L, StkId func, int nResults) { | 342 | void luaD_call (lua_State *L, StkId func, int nResults) { |
| 343 | if (++L->nCcalls >= LUAC_MAXCCALLS) { | 343 | if (++L->nCcalls >= LUAI_MAXCCALLS) { |
| 344 | if (L->nCcalls == LUAC_MAXCCALLS) | 344 | if (L->nCcalls == LUAI_MAXCCALLS) |
| 345 | luaG_runerror(L, "C stack overflow"); | 345 | luaG_runerror(L, "C stack overflow"); |
| 346 | else if (L->nCcalls >= (LUAC_MAXCCALLS + (LUAC_MAXCCALLS>>3))) | 346 | else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) |
| 347 | luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ | 347 | luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ |
| 348 | } | 348 | } |
| 349 | if (luaD_precall(L, func, nResults) == PCRLUA) { /* is a Lua function? */ | 349 | if (luaD_precall(L, func, nResults) == PCRLUA) { /* is a Lua function? */ |
