diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-10-10 14:40:17 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-10-10 14:40:17 -0300 |
commit | afa0d0ac0df60e37fd9473f50041505246228b35 (patch) | |
tree | 4e1bff8a0be61220148e1443a15899f9be2944a5 /ldo.c | |
parent | 742b8be0c13b2abd6702c54c5f3ea929c3a9245f (diff) | |
download | lua-afa0d0ac0df60e37fd9473f50041505246228b35.tar.gz lua-afa0d0ac0df60e37fd9473f50041505246228b35.tar.bz2 lua-afa0d0ac0df60e37fd9473f50041505246228b35.zip |
new constant LUA_OK
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.42 2006/09/11 14:07:24 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.43 2006/09/19 13:57:50 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 | */ |
@@ -110,7 +110,7 @@ void luaD_throw (lua_State *L, int errcode) { | |||
110 | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | 110 | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { |
111 | unsigned short oldnCcalls = G(L)->nCcalls; | 111 | unsigned short oldnCcalls = G(L)->nCcalls; |
112 | struct lua_longjmp lj; | 112 | struct lua_longjmp lj; |
113 | lj.status = 0; | 113 | lj.status = LUA_OK; |
114 | lj.previous = L->errorJmp; /* chain new error handler */ | 114 | lj.previous = L->errorJmp; /* chain new error handler */ |
115 | L->errorJmp = &lj; | 115 | L->errorJmp = &lj; |
116 | LUAI_TRY(L, &lj, | 116 | LUAI_TRY(L, &lj, |
@@ -391,14 +391,14 @@ void luaD_call (lua_State *L, StkId func, int nResults) { | |||
391 | static void resume (lua_State *L, void *ud) { | 391 | static void resume (lua_State *L, void *ud) { |
392 | StkId firstArg = cast(StkId, ud); | 392 | StkId firstArg = cast(StkId, ud); |
393 | CallInfo *ci = L->ci; | 393 | CallInfo *ci = L->ci; |
394 | if (L->status == 0) { /* start coroutine? */ | 394 | if (L->status == LUA_OK) { /* start coroutine? */ |
395 | lua_assert(ci == L->base_ci && firstArg > L->base); | 395 | lua_assert(ci == L->base_ci && firstArg > L->base); |
396 | if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) | 396 | if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) |
397 | return; | 397 | return; |
398 | } | 398 | } |
399 | else { /* resuming from previous yield */ | 399 | else { /* resuming from previous yield */ |
400 | lua_assert(L->status == LUA_YIELD); | 400 | lua_assert(L->status == LUA_YIELD); |
401 | L->status = 0; | 401 | L->status = LUA_OK; |
402 | if (!f_isLua(ci)) { /* `common' yield? */ | 402 | if (!f_isLua(ci)) { /* `common' yield? */ |
403 | /* finish interrupted execution of `OP_CALL' */ | 403 | /* finish interrupted execution of `OP_CALL' */ |
404 | lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || | 404 | lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || |
@@ -426,7 +426,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) { | |||
426 | int status; | 426 | int status; |
427 | lua_lock(L); | 427 | lua_lock(L); |
428 | if (L->status != LUA_YIELD) { | 428 | if (L->status != LUA_YIELD) { |
429 | if (L->status != 0) | 429 | if (L->status != LUA_OK) |
430 | return resume_error(L, "cannot resume dead coroutine"); | 430 | return resume_error(L, "cannot resume dead coroutine"); |
431 | else if (L->ci != L->base_ci) | 431 | else if (L->ci != L->base_ci) |
432 | return resume_error(L, "cannot resume non-suspended coroutine"); | 432 | return resume_error(L, "cannot resume non-suspended coroutine"); |
@@ -437,7 +437,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) { | |||
437 | return resume_error(L, "C stack overflow"); | 437 | return resume_error(L, "C stack overflow"); |
438 | L->baseCcalls = ++G(L)->nCcalls; | 438 | L->baseCcalls = ++G(L)->nCcalls; |
439 | status = luaD_rawrunprotected(L, resume, L->top - nargs); | 439 | status = luaD_rawrunprotected(L, resume, L->top - nargs); |
440 | if (status != 0) { /* error? */ | 440 | if (status != LUA_OK) { /* error? */ |
441 | L->status = cast_byte(status); /* mark thread as `dead' */ | 441 | L->status = cast_byte(status); /* mark thread as `dead' */ |
442 | luaD_seterrorobj(L, status, L->top); | 442 | luaD_seterrorobj(L, status, L->top); |
443 | L->ci->top = L->top; | 443 | L->ci->top = L->top; |
@@ -473,7 +473,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u, | |||
473 | ptrdiff_t old_errfunc = L->errfunc; | 473 | ptrdiff_t old_errfunc = L->errfunc; |
474 | L->errfunc = ef; | 474 | L->errfunc = ef; |
475 | status = luaD_rawrunprotected(L, func, u); | 475 | status = luaD_rawrunprotected(L, func, u); |
476 | if (status != 0) { /* an error occurred? */ | 476 | if (status != LUA_OK) { /* an error occurred? */ |
477 | StkId oldtop = restorestack(L, old_top); | 477 | StkId oldtop = restorestack(L, old_top); |
478 | luaF_close(L, oldtop); /* close possible pending closures */ | 478 | luaF_close(L, oldtop); /* close possible pending closures */ |
479 | luaD_seterrorobj(L, status, oldtop); | 479 | luaD_seterrorobj(L, status, oldtop); |