49#if !defined(LUAI_THROW)
51#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
53#define LUAI_THROW(L,c) throw(c)
54#define LUAI_TRY(L,c,a) \
55 try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
56#define luai_jmpbuf int
58#elif defined(LUA_USE_ULONGJMP)
60#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
61#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
62#define luai_jmpbuf jmp_buf
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
110 if (
G(L)->mainthread->errorJmp) {
126 unsigned short oldnCcalls = L->
nCcalls;
158#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200)
167 for (; lim < newsize; lim++)
181 int newsize = 2 * size;
183 if (newsize < needed) newsize = needed;
199 if (lim < ci->top) lim = ci->
top;
207 int goodsize = inuse + (inuse / 8) + 2*
EXTRA_STACK;
264 fixed = L->
top - actual;
266 for (i=0; i<nfixargs; i++) {
290#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L)))
301 switch (
ttype(func)) {
368 ptrdiff_t fr =
savestack(L, firstResult);
378 for (i = wanted; i != 0 && firstResult < L->
top; i--)
400 if (!allowyield) L->
nny++;
403 if (!allowyield) L->
nny--;
464 if (ci ==
NULL)
return 0;
504 resume_error(L,
"cannot resume non-suspended coroutine", firstArg);
510 resume_error(L,
"cannot resume dead coroutine", firstArg);
525 firstArg = L->
top - n;
573 if (L !=
G(L)->mainthread)
574 luaG_runerror(L,
"attempt to yield across a C-call boundary");
576 luaG_runerror(L,
"attempt to yield from outside a coroutine");
581 api_check(L, k ==
NULL,
"hooks cannot continue after yielding");
586 ci->
func = L->
top - nresults - 1;
596 ptrdiff_t old_top, ptrdiff_t ef) {
600 unsigned short old_nny = L->
nny;
601 ptrdiff_t old_errfunc = L->
errfunc;
632 if (mode && strchr(mode, x[0]) ==
NULL) {
634 "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
654 for (i = 0; i < cl->
l.nupvalues; i++) {
#define api_checknelems(L, n)
#define adjustresults(L, nres)
static int panic(lua_State *L)
void luaG_runerror(lua_State *L, const char *fmt,...)
void luaG_typeerror(lua_State *L, const TValue *o, const char *op)
void(* Pfunc)(lua_State *L, void *ud)
#define restorestack(L, n)
#define luaD_checkstack(L, n)
UpVal * luaF_newupval(lua_State *L)
void luaF_close(lua_State *L, StkId level)
#define luaC_objbarrier(L, p, o)
#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)
static CallInfo * findpcall(lua_State *L)
void luaD_hook(lua_State *L, int event, int line)
LUA_API int lua_resume(lua_State *L, lua_State *from, int nargs)
static void f_parser(lua_State *L, void *ud)
static StkId adjust_varargs(lua_State *L, Proto *p, int actual)
int luaD_pcall(lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
void luaD_shrinkstack(lua_State *L)
static l_noret resume_error(lua_State *L, const char *msg, StkId firstArg)
l_noret luaD_throw(lua_State *L, int errcode)
static void callhook(lua_State *L, CallInfo *ci)
static void unroll(lua_State *L, void *ud)
LUA_API int lua_yieldk(lua_State *L, int nresults, int ctx, lua_CFunction k)
int luaD_protectedparser(lua_State *L, ZIO *z, const char *name, const char *mode)
int luaD_precall(lua_State *L, StkId func, int nresults)
static void checkmode(lua_State *L, const char *mode, const char *x)
void luaD_growstack(lua_State *L, int n)
static int recover(lua_State *L, int status)
static void correctstack(lua_State *L, TValue *oldstack)
static StkId tryfuncTM(lua_State *L, StkId func)
int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud)
int luaD_poscall(lua_State *L, StkId firstResult)
static void resume(lua_State *L, void *ud)
void luaD_call(lua_State *L, StkId func, int nResults, int allowyield)
static int stackinuse(lua_State *L)
#define LUAI_TRY(L, c, a)
static void finishCcall(lua_State *L)
static void seterrorobj(lua_State *L, int errcode, StkId oldtop)
void luaD_reallocstack(lua_State *L, int newsize)
void luaV_finishOp(lua_State *L)
LUAI_FUNC Proto * luaY_parser(lua_State *L, ZIO *z, Mbuffer *buff, const char *name)
struct CallInfo * previous
struct CallInfo::@64::@65 l
const Instruction * savedpc
struct CallInfo::@64::@66 c
struct Dyndata::@63 actvar
struct lua_longjmp * errorJmp
const Instruction * oldpc
struct lua_longjmp * previous