Lines Matching refs:L

33 static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
47 static void swapextra (lua_State *L) { in swapextra() argument
48 if (L->status == LUA_YIELD) { in swapextra()
49 CallInfo *ci = L->ci; /* get function that yielded */ in swapextra()
51 ci->func = restorestack(L, ci->extra); in swapextra()
52 ci->extra = savestack(L, temp); in swapextra()
60 LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { in lua_sethook() argument
65 if (isLua(L->ci)) in lua_sethook()
66 L->oldpc = L->ci->u.l.savedpc; in lua_sethook()
67 L->hook = func; in lua_sethook()
68 L->basehookcount = count; in lua_sethook()
69 resethookcount(L); in lua_sethook()
70 L->hookmask = cast_byte(mask); in lua_sethook()
75 LUA_API lua_Hook lua_gethook (lua_State *L) { in lua_gethook() argument
76 return L->hook; in lua_gethook()
80 LUA_API int lua_gethookmask (lua_State *L) { in lua_gethookmask() argument
81 return L->hookmask; in lua_gethookmask()
85 LUA_API int lua_gethookcount (lua_State *L) { in lua_gethookcount() argument
86 return L->basehookcount; in lua_gethookcount()
90 LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { in lua_getstack() argument
94 lua_lock(L); in lua_getstack()
95 for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) in lua_getstack()
97 if (level == 0 && ci != &L->base_ci) { /* level found? */ in lua_getstack()
102 lua_unlock(L); in lua_getstack()
125 static const char *findlocal (lua_State *L, CallInfo *ci, int n, in findlocal() argument
140 StkId limit = (ci == L->ci) ? L->top : ci->next->func; in findlocal()
151 LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { in lua_getlocal() argument
153 lua_lock(L); in lua_getlocal()
154 swapextra(L); in lua_getlocal()
156 if (!isLfunction(L->top - 1)) /* not a Lua function? */ in lua_getlocal()
159 name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); in lua_getlocal()
163 name = findlocal(L, ar->i_ci, n, &pos); in lua_getlocal()
165 setobj2s(L, L->top, pos); in lua_getlocal()
166 api_incr_top(L); in lua_getlocal()
169 swapextra(L); in lua_getlocal()
170 lua_unlock(L); in lua_getlocal()
175 LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { in lua_setlocal() argument
178 lua_lock(L); in lua_setlocal()
179 swapextra(L); in lua_setlocal()
180 name = findlocal(L, ar->i_ci, n, &pos); in lua_setlocal()
182 setobjs2s(L, pos, L->top - 1); in lua_setlocal()
183 L->top--; /* pop value */ in lua_setlocal()
184 swapextra(L); in lua_setlocal()
185 lua_unlock(L); in lua_setlocal()
208 static void collectvalidlines (lua_State *L, Closure *f) { in collectvalidlines() argument
210 setnilvalue(L->top); in collectvalidlines()
211 api_incr_top(L); in collectvalidlines()
217 Table *t = luaH_new(L); /* new table to store active lines */ in collectvalidlines()
218 sethvalue(L, L->top, t); /* push it on stack */ in collectvalidlines()
219 api_incr_top(L); in collectvalidlines()
222 luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ in collectvalidlines()
227 static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, in auxgetinfo() argument
259 ar->namewhat = getfuncname(L, ci->previous, &ar->name); in auxgetinfo()
278 LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { in lua_getinfo() argument
283 lua_lock(L); in lua_getinfo()
284 swapextra(L); in lua_getinfo()
287 func = L->top - 1; in lua_getinfo()
288 api_check(L, ttisfunction(func), "function expected"); in lua_getinfo()
290 L->top--; /* pop function */ in lua_getinfo()
298 status = auxgetinfo(L, what, ar, cl, ci); in lua_getinfo()
300 setobjs2s(L, L->top, func); in lua_getinfo()
301 api_incr_top(L); in lua_getinfo()
303 swapextra(L); in lua_getinfo()
305 collectvalidlines(L, cl); in lua_getinfo()
306 lua_unlock(L); in lua_getinfo()
459 static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { in getfuncname() argument
493 *name = getstr(G(L)->tmname[tm]); in getfuncname()
527 l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { in luaG_typeerror() argument
528 CallInfo *ci = L->ci; in luaG_typeerror()
539 luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", in luaG_typeerror()
542 luaG_runerror(L, "attempt to %s a %s value", op, t); in luaG_typeerror()
546 l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2) { in luaG_concaterror() argument
549 luaG_typeerror(L, p1, "concatenate"); in luaG_concaterror()
553 l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { in luaG_aritherror() argument
557 luaG_typeerror(L, p2, "perform arithmetic on"); in luaG_aritherror()
561 l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { in luaG_ordererror() argument
565 luaG_runerror(L, "attempt to compare two %s values", t1); in luaG_ordererror()
567 luaG_runerror(L, "attempt to compare %s with %s", t1, t2); in luaG_ordererror()
571 static void addinfo (lua_State *L, const char *msg) { in addinfo() argument
572 CallInfo *ci = L->ci; in addinfo()
582 luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); in addinfo()
587 l_noret luaG_errormsg (lua_State *L) { in luaG_errormsg() argument
588 if (L->errfunc != 0) { /* is there an error handling function? */ in luaG_errormsg()
589 StkId errfunc = restorestack(L, L->errfunc); in luaG_errormsg()
590 if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); in luaG_errormsg()
591 setobjs2s(L, L->top, L->top - 1); /* move argument */ in luaG_errormsg()
592 setobjs2s(L, L->top - 1, errfunc); /* push function */ in luaG_errormsg()
593 L->top++; in luaG_errormsg()
594 luaD_call(L, L->top - 2, 1, 0); /* call it */ in luaG_errormsg()
596 luaD_throw(L, LUA_ERRRUN); in luaG_errormsg()
600 l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { in luaG_runerror() argument
603 addinfo(L, luaO_pushvfstring(L, fmt, argp)); in luaG_runerror()
605 luaG_errormsg(L); in luaG_runerror()