diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-12-22 14:19:56 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-12-22 14:19:56 -0200 |
| commit | c505f341d638f8f0adcef4df85bcc8def6c930a3 (patch) | |
| tree | bfa689a7545e47cfd154066cd8d962daa6bc611e /ldo.c | |
| parent | 428325baecb2f514ea3eb6c87405f93872fb8430 (diff) | |
| download | lua-c505f341d638f8f0adcef4df85bcc8def6c930a3.tar.gz lua-c505f341d638f8f0adcef4df85bcc8def6c930a3.tar.bz2 lua-c505f341d638f8f0adcef4df85bcc8def6c930a3.zip | |
small changes in casts
Diffstat (limited to 'ldo.c')
| -rw-r--r-- | ldo.c | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.35 2005/10/14 16:23:33 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.36 2005/10/23 17:52:42 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 | */ |
| @@ -71,7 +71,7 @@ void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { | |||
| 71 | static void restore_stack_limit (lua_State *L) { | 71 | static void restore_stack_limit (lua_State *L) { |
| 72 | lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); | 72 | lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); |
| 73 | if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ | 73 | if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ |
| 74 | int inuse = cast(int, L->ci - L->base_ci); | 74 | int inuse = cast_int(L->ci - L->base_ci); |
| 75 | if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ | 75 | if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ |
| 76 | luaD_reallocCI(L, LUAI_MAXCALLS); | 76 | luaD_reallocCI(L, LUAI_MAXCALLS); |
| 77 | } | 77 | } |
| @@ -97,7 +97,7 @@ void luaD_throw (lua_State *L, int errcode) { | |||
| 97 | LUAI_THROW(L, L->errorJmp); | 97 | LUAI_THROW(L, L->errorJmp); |
| 98 | } | 98 | } |
| 99 | else { | 99 | else { |
| 100 | L->status = cast(lu_byte, errcode); | 100 | L->status = cast_byte(errcode); |
| 101 | if (G(L)->panic) { | 101 | if (G(L)->panic) { |
| 102 | resetstack(L, errcode); | 102 | resetstack(L, errcode); |
| 103 | lua_unlock(L); | 103 | lua_unlock(L); |
| @@ -189,7 +189,7 @@ void luaD_callhook (lua_State *L, int event, int line) { | |||
| 189 | if (event == LUA_HOOKTAILRET) | 189 | if (event == LUA_HOOKTAILRET) |
| 190 | ar.i_ci = 0; /* tail call; no debug information about it */ | 190 | ar.i_ci = 0; /* tail call; no debug information about it */ |
| 191 | else | 191 | else |
| 192 | ar.i_ci = cast(int, L->ci - L->base_ci); | 192 | ar.i_ci = cast_int(L->ci - L->base_ci); |
| 193 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ | 193 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ |
| 194 | L->ci->top = L->top + LUA_MINSTACK; | 194 | L->ci->top = L->top + LUA_MINSTACK; |
| 195 | lua_assert(L->ci->top <= L->stack_last); | 195 | lua_assert(L->ci->top <= L->stack_last); |
| @@ -221,8 +221,7 @@ static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { | |||
| 221 | for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */ | 221 | for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */ |
| 222 | setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i); | 222 | setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i); |
| 223 | /* store counter in field `n' */ | 223 | /* store counter in field `n' */ |
| 224 | setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), | 224 | setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); |
| 225 | cast(lua_Number, nvar)); | ||
| 226 | } | 225 | } |
| 227 | #endif | 226 | #endif |
| 228 | /* move fixed parameters to final position */ | 227 | /* move fixed parameters to final position */ |
| @@ -282,7 +281,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
| 282 | L->top = base + p->numparams; | 281 | L->top = base + p->numparams; |
| 283 | } | 282 | } |
| 284 | else { /* vararg function */ | 283 | else { /* vararg function */ |
| 285 | int nargs = cast(int, L->top - func) - 1; | 284 | int nargs = cast_int(L->top - func) - 1; |
| 286 | base = adjust_varargs(L, p, nargs); | 285 | base = adjust_varargs(L, p, nargs); |
| 287 | func = restorestack(L, funcr); /* previous call may change the stack */ | 286 | func = restorestack(L, funcr); /* previous call may change the stack */ |
| 288 | } | 287 | } |
| @@ -401,7 +400,7 @@ static void resume (lua_State *L, void *ud) { | |||
| 401 | L->base = L->ci->base; | 400 | L->base = L->ci->base; |
| 402 | } | 401 | } |
| 403 | L->status = 0; | 402 | L->status = 0; |
| 404 | luaV_execute(L, cast(int, L->ci - L->base_ci)); | 403 | luaV_execute(L, cast_int(L->ci - L->base_ci)); |
| 405 | } | 404 | } |
| 406 | 405 | ||
| 407 | 406 | ||
| @@ -427,7 +426,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) { | |||
| 427 | lua_assert(L->errfunc == 0 && L->nCcalls == 0); | 426 | lua_assert(L->errfunc == 0 && L->nCcalls == 0); |
| 428 | status = luaD_rawrunprotected(L, resume, L->top - nargs); | 427 | status = luaD_rawrunprotected(L, resume, L->top - nargs); |
| 429 | if (status != 0) { /* error? */ | 428 | if (status != 0) { /* error? */ |
| 430 | L->status = cast(lu_byte, status); /* mark thread as `dead' */ | 429 | L->status = cast_byte(status); /* mark thread as `dead' */ |
| 431 | luaD_seterrorobj(L, status, L->top); | 430 | luaD_seterrorobj(L, status, L->top); |
| 432 | L->ci->top = L->top; | 431 | L->ci->top = L->top; |
| 433 | } | 432 | } |
