Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
ldebug.h File Reference
#include "lstate.h"

Go to the source code of this file.

Macros

#define pcRel(pc, p)   (cast(int, (pc) - (p)->code) - 1)
 
#define getfuncline(f, pc)   (((f)->lineinfo) ? (f)->lineinfo[pc] : -1)
 
#define resethookcount(L)   (L->hookcount = L->basehookcount)
 

Functions

LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *opname)
 
LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2)
 
LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, const TValue *p2, const char *msg)
 
LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2)
 
LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2)
 
LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt,...)
 
LUAI_FUNC const char * luaG_addinfo (lua_State *L, const char *msg, TString *src, int line)
 
LUAI_FUNC l_noret luaG_errormsg (lua_State *L)
 
LUAI_FUNC void luaG_traceexec (lua_State *L)
 

Macro Definition Documentation

◆ getfuncline

#define getfuncline ( f,
pc )   (((f)->lineinfo) ? (f)->lineinfo[pc] : -1)

Definition at line 16 of file lua-5.3.6/src/ldebug.h.

◆ pcRel

#define pcRel ( pc,
p )   (cast(int, (pc) - (p)->code) - 1)

Definition at line 14 of file lua-5.3.6/src/ldebug.h.

◆ resethookcount

#define resethookcount ( L)    (L->hookcount = L->basehookcount)

Definition at line 18 of file lua-5.3.6/src/ldebug.h.

Function Documentation

◆ luaG_addinfo()

LUAI_FUNC const char * luaG_addinfo ( lua_State * L,
const char * msg,
TString * src,
int line )

Definition at line 629 of file lua-5.3.6/src/ldebug.c.

630 {
631 char buff[LUA_IDSIZE];
632 if (src)
633 luaO_chunkid(buff, getstr(src), LUA_IDSIZE);
634 else { /* no source available; use "?" instead */
635 buff[0] = '?'; buff[1] = '\0';
636 }
637 return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
638}
void luaO_chunkid(char *out, const char *source, size_t bufflen)
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
#define getstr(ts)
#define LUA_IDSIZE

◆ luaG_concaterror()

LUAI_FUNC l_noret luaG_concaterror ( lua_State * L,
const TValue * p1,
const TValue * p2 )

Definition at line 592 of file lua-5.3.6/src/ldebug.c.

592 {
593 if (ttisstring(p1) || cvt2str(p1)) p1 = p2;
594 luaG_typeerror(L, p1, "concatenate");
595}
#define ttisstring(o)
l_noret luaG_typeerror(lua_State *L, const TValue *o, const char *op)
#define cvt2str(o)

◆ luaG_errormsg()

LUAI_FUNC l_noret luaG_errormsg ( lua_State * L)

Definition at line 618 of file lua-5.1.5/src/ldebug.c.

618 {
619 if (L->errfunc != 0) { /* is there an error handling function? */
620 StkId errfunc = restorestack(L, L->errfunc);
621 if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
622 setobjs2s(L, L->top, L->top - 1); /* move argument */
623 setobjs2s(L, L->top - 1, errfunc); /* push function */
624 incr_top(L);
625 luaD_call(L, L->top - 2, 1); /* call it */
626 }
628}
void luaD_call(lua_State *L, StkId func, int nResults)
void luaD_throw(lua_State *L, int errcode)
#define restorestack(L, n)
#define incr_top(L)
#define ttisfunction(o)
#define setobjs2s
#define LUA_ERRERR
#define LUA_ERRRUN

◆ luaG_opinterror()

LUAI_FUNC l_noret luaG_opinterror ( lua_State * L,
const TValue * p1,
const TValue * p2,
const char * msg )

Definition at line 598 of file lua-5.3.6/src/ldebug.c.

599 {
600 lua_Number temp;
601 if (!tonumber(p1, &temp)) /* first operand is wrong? */
602 p2 = p1; /* now second is wrong */
603 luaG_typeerror(L, p2, msg);
604}
LUA_NUMBER lua_Number
#define tonumber(o, n)

◆ luaG_ordererror()

LUAI_FUNC l_noret luaG_ordererror ( lua_State * L,
const TValue * p1,
const TValue * p2 )

Definition at line 596 of file lua-5.1.5/src/ldebug.c.

596 {
597 const char *t1 = luaT_typenames[ttype(p1)];
598 const char *t2 = luaT_typenames[ttype(p2)];
599 if (t1[2] == t2[2])
600 luaG_runerror(L, "attempt to compare two %s values", t1);
601 else
602 luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
603 return 0;
604}
void luaG_runerror(lua_State *L, const char *fmt,...)
#define ttype(o)
const char *const luaT_typenames[]

◆ luaG_runerror()

LUAI_FUNC l_noret luaG_runerror ( lua_State * L,
const char * fmt,
... )

Definition at line 631 of file lua-5.1.5/src/ldebug.c.

631 {
632 va_list argp;
633 va_start(argp, fmt);
634 addinfo(L, luaO_pushvfstring(L, fmt, argp));
635 va_end(argp);
636 luaG_errormsg(L);
637}
static void addinfo(lua_State *L, const char *msg)
void luaG_errormsg(lua_State *L)
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)

◆ luaG_tointerror()

LUAI_FUNC l_noret luaG_tointerror ( lua_State * L,
const TValue * p1,
const TValue * p2 )

Definition at line 610 of file lua-5.3.6/src/ldebug.c.

610 {
611 lua_Integer temp;
612 if (!tointeger(p1, &temp))
613 p2 = p1;
614 luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2));
615}
LUA_INTEGER lua_Integer
l_noret luaG_runerror(lua_State *L, const char *fmt,...)
static const char * varinfo(lua_State *L, const TValue *o)
#define tointeger(o, i)

◆ luaG_traceexec()

LUAI_FUNC void luaG_traceexec ( lua_State * L)

Definition at line 667 of file lua-5.3.6/src/ldebug.c.

667 {
668 CallInfo *ci = L->ci;
669 lu_byte mask = L->hookmask;
670 int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT));
671 if (counthook)
672 resethookcount(L); /* reset count */
673 else if (!(mask & LUA_MASKLINE))
674 return; /* no line hook and count != 0; nothing to be done */
675 if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
676 ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
677 return; /* do not call hook again (VM yielded, so it did not move) */
678 }
679 if (counthook)
680 luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */
681 if (mask & LUA_MASKLINE) {
682 Proto *p = ci_func(ci)->p;
683 int npc = pcRel(ci->u.l.savedpc, p);
684 int newline = getfuncline(p, npc);
685 if (npc == 0 || /* call linehook when enter a new function, */
686 ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */
687 newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */
688 luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */
689 }
690 L->oldpc = ci->u.l.savedpc;
691 if (L->status == LUA_YIELD) { /* did hook yield? */
692 if (counthook)
693 L->hookcount = 1; /* undo decrement to zero */
694 ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
695 ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
696 ci->func = L->top - 1; /* protect stack below results */
698 }
699}
#define pcRel(pc, p)
#define resethookcount(L)
unsigned char lu_byte
#define LUA_MASKCOUNT
#define LUA_MASKLINE
#define LUA_HOOKCOUNT
#define LUA_YIELD
#define LUA_HOOKLINE
#define mask(n)
#define getfuncline(f, pc)
void luaD_hook(lua_State *L, int event, int line)
#define CIST_HOOKYIELD
#define ci_func(ci)
struct CallInfo::@64::@65 l
const Instruction * savedpc
union CallInfo::@64 u
struct Proto ** p
const Instruction * oldpc

References CallInfo::callstatus, lua_State::ci, ci_func, CIST_HOOKYIELD, CallInfo::func, getfuncline, lua_State::hookcount, lua_State::hookmask, CallInfo::l, LUA_HOOKCOUNT, LUA_HOOKLINE, LUA_MASKCOUNT, LUA_MASKLINE, LUA_YIELD, luaD_hook(), luaD_throw(), mask, lua_State::oldpc, Proto::p, pcRel, resethookcount, CallInfo::savedpc, lua_State::status, lua_State::top, and CallInfo::u.

◆ luaG_typeerror()

LUAI_FUNC l_noret luaG_typeerror ( lua_State * L,
const TValue * o,
const char * opname )

Definition at line 567 of file lua-5.1.5/src/ldebug.c.

567 {
568 const char *name = NULL;
569 const char *t = luaT_typenames[ttype(o)];
570 const char *kind = (isinstack(L->ci, o)) ?
571 getobjname(L, L->ci, cast_int(o - L->base), &name) :
572 NULL;
573 if (kind)
574 luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
575 op, kind, name, t);
576 else
577 luaG_runerror(L, "attempt to %s a %s value", op, t);
578}
#define NULL
Definition gmacros.h:924
const char * name
Definition lsqlite3.c:2154
static const char * getobjname(lua_State *L, CallInfo *ci, int stackpos, const char **name)
static int isinstack(CallInfo *ci, const TValue *o)
#define cast_int(i)
#define LUA_QS