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] : 0)
 
#define resethookcount(L)   (L->hookcount = L->basehookcount)
 
#define ci_func(ci)   (clLvalue((ci)->func))
 

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, StkId p1, StkId p2)
 
LUAI_FUNC l_noret luaG_aritherror (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 l_noret luaG_errormsg (lua_State *L)
 

Macro Definition Documentation

◆ ci_func

#define ci_func ( ci)    (clLvalue((ci)->func))

Definition at line 21 of file lua-5.2.4/src/ldebug.h.

◆ getfuncline

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

◆ pcRel

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

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

◆ resethookcount

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

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

Function Documentation

◆ luaG_aritherror()

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

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

588 {
589 TValue temp;
590 if (luaV_tonumber(p1, &temp) == NULL)
591 p2 = p1; /* first operand is wrong */
592 luaG_typeerror(L, p2, "perform arithmetic on");
593}
#define NULL
Definition gmacros.h:924
void luaG_typeerror(lua_State *L, const TValue *o, const char *op)
const TValue * luaV_tonumber(const TValue *obj, TValue *n)

References luaG_typeerror(), luaV_tonumber(), and NULL.

Referenced by Arith(), and luaV_arith().

◆ luaG_concaterror()

LUAI_FUNC l_noret luaG_concaterror ( lua_State * L,
StkId p1,
StkId p2 )

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

581 {
582 if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
583 lua_assert(!ttisstring(p1) && !ttisnumber(p1));
584 luaG_typeerror(L, p1, "concatenate");
585}
#define lua_assert(c)
#define ttisnumber(o)
#define ttisstring(o)

References lua_assert, luaG_typeerror(), ttisnumber, and ttisstring.

Referenced by luaT_trybinTM(), luaT_tryconcatTM(), luaV_concat(), and luaV_concat().

◆ 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_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_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}
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