38#define errorstatus(s) ((s) > LUA_YIELD)
53#if !defined(LUAI_THROW)
55#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
58#define LUAI_THROW(L,c) throw(c)
59#define LUAI_TRY(L,c,a) \
60 try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
61#define luai_jmpbuf int
63#elif defined(LUA_USE_POSIX)
66#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
67#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
68#define luai_jmpbuf jmp_buf
73#define LUAI_THROW(L,c) longjmp((c)->b, 1)
74#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
75#define luai_jmpbuf jmp_buf
163 L->
top = (L->
top - oldstack) + newstack;
168 ci->
top = (ci->
top - oldstack) + newstack;
169 ci->
func = (ci->
func - oldstack) + newstack;
177#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200)
197 if (l_unlikely(newstack ==
NULL)) {
203 i = ((oldsize <= newsize) ? oldsize : newsize) +
EXTRA_STACK;
231 int newsize = 2 * size;
235 if (newsize < needed)
255 if (lim < ci->top) lim = ci->
top;
276 int nsize = inuse * 2;
307 int ftransfer,
int ntransfer) {
318 if (ntransfer != 0) {
376 ftransfer =
cast(
unsigned short, firstres - ci->
func);
395 for (p = L->
top; p > func; p--)
442 firstresult = L->
top - nres;
445 for (i = 0; i < nres; i++)
447 for (; i < wanted; i++)
449 L->
top = res + wanted;
473#define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L))
486 for (i = 0; i < narg1; i++)
490 for (; narg1 <= nfixparams; narg1++)
492 ci->
top = func + 1 + fsize;
496 L->
top = func + narg1;
548 ci->
top = func + 1 + fsize;
551 for (; narg < nfixparams; narg++)
587 ccall(L, func, nResults, 1);
727 int n = *(
cast(
int*, ud));
779 return resume_error(L,
"cannot resume non-suspended coroutine", nargs);
780 else if (L->
top - (L->
ci->
func + 1) == nargs)
781 return resume_error(L,
"cannot resume dead coroutine", nargs);
784 return resume_error(L,
"cannot resume dead coroutine", nargs);
818 if (L !=
G(L)->mainthread)
819 luaG_runerror(L,
"attempt to yield across a C-call boundary");
821 luaG_runerror(L,
"attempt to yield from outside a coroutine");
827 api_check(L, nresults == 0,
"hooks cannot yield values");
828 api_check(L, k ==
NULL,
"hooks cannot continue after yielding");
886 ptrdiff_t old_top, ptrdiff_t ef) {
890 ptrdiff_t old_errfunc = L->
errfunc;
919 if (mode && strchr(mode, x[0]) ==
NULL) {
921 "attempt to load a %s chunk (mode is '%s')", x, mode);
#define api_checknelems(L, n)
#define adjustresults(L, nres)
void luaG_runerror(lua_State *L, const char *fmt,...)
void(* Pfunc)(lua_State *L, void *ud)
#define restorestack(L, n)
#define luaD_checkstack(L, n)
void luaF_close(lua_State *L, StkId level)
#define luaM_freearray(L, b, n, t)
#define luaM_reallocvector(L, v, oldn, n, t)
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
#define luaS_newliteral(L, s)
const TValue * luaT_gettmbyobj(lua_State *L, const TValue *o, TMS event)
int(* lua_CFunction)(lua_State *L)
void(* lua_Hook)(lua_State *L, lua_Debug *ar)
#define luai_userstateyield(L, n)
#define luai_userstateresume(L, n)
Proto * luaU_undump(lua_State *L, ZIO *Z, Mbuffer *buff, const char *name)
void luaV_execute(lua_State *L, int nexeccalls)
#define luaZ_initbuffer(L, buff)
#define luaZ_freebuffer(L, buff)
void luaV_finishOp(lua_State *L)
void luaF_initupvals(lua_State *L, LClosure *cl)
void luaE_shrinkCI(lua_State *L)
LUA_KCONTEXT lua_KContext
int(* lua_KFunction)(lua_State *L, int status, lua_KContext ctx)
#define hastocloseCfunc(n)
#define decodeNresults(n)
l_noret luaG_callerror(lua_State *L, const TValue *o)
static CallInfo * findpcall(lua_State *L)
CallInfo * luaD_precall(lua_State *L, StkId func, int nresults)
static void f_parser(lua_State *L, void *ud)
int luaD_pcall(lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
void luaD_pretailcall(lua_State *L, CallInfo *ci, StkId func, int narg1)
void luaD_shrinkstack(lua_State *L)
static void finishCcall(lua_State *L, CallInfo *ci)
void luaD_seterrorobj(lua_State *L, int errcode, StkId oldtop)
l_noret luaD_throw(lua_State *L, int errcode)
static void unroll(lua_State *L, void *ud)
LUA_API int lua_yieldk(lua_State *L, int nresults, lua_KContext ctx, lua_KFunction k)
int luaD_protectedparser(lua_State *L, ZIO *z, const char *name, const char *mode)
static void checkmode(lua_State *L, const char *mode, const char *x)
LUA_API int lua_isyieldable(lua_State *L)
void luaD_inctop(lua_State *L)
void luaD_call(lua_State *L, StkId func, int nResults)
void luaD_hookcall(lua_State *L, CallInfo *ci)
void luaD_callnoyield(lua_State *L, StkId func, int nResults)
int luaD_growstack(lua_State *L, int n, int raiseerror)
int luaD_reallocstack(lua_State *L, int newsize, int raiseerror)
static int resume_error(lua_State *L, const char *msg, int narg)
static int precover(lua_State *L, int status)
void luaD_poscall(lua_State *L, CallInfo *ci, int nres)
int luaD_closeprotected(lua_State *L, ptrdiff_t level, int status)
static void closepaux(lua_State *L, void *ud)
void luaD_hook(lua_State *L, int event, int line, int ftransfer, int ntransfer)
static void ccall(lua_State *L, StkId func, int nResults, int inc)
int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud)
static void rethook(lua_State *L, CallInfo *ci, int nres)
static void resume(lua_State *L, void *ud)
static void correctstack(lua_State *L, StkId oldstack, StkId newstack)
static int stackinuse(lua_State *L)
void luaD_tryfuncTM(lua_State *L, StkId func)
LUA_API int lua_resume(lua_State *L, lua_State *from, int nargs, int *nresults)
#define LUAI_TRY(L, c, a)
static void moveresults(lua_State *L, StkId res, int nres, int wanted)
static int finishpcallk(lua_State *L, CallInfo *ci)
#define checkstackGCp(L, n, p)
#define checkstackGC(L, fsize)
int luaE_resetthread(lua_State *L, int status)
void luaE_checkcstack(lua_State *L)
LUAI_FUNC void luaE_incCstack(lua_State *L)
#define setcistrecst(ci, st)
LUAI_FUNC Proto * luaY_parser(lua_State *L, ZIO *z, Mbuffer *buff, const char *name)
struct CallInfo * previous
struct CallInfo::@95::@98 transferinfo
struct CallInfo::@64::@65 l
const Instruction * savedpc
struct CallInfo::@64::@66 c
struct Dyndata::@63 actvar
struct UpVal::@68::@69 open
struct lua_State * mainthread
struct lua_longjmp * errorJmp
const Instruction * oldpc
struct lua_longjmp * previous