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 getline(f, pc)   (((f)->lineinfo) ? (f)->lineinfo[pc] : 0)
 
#define resethookcount(L)   (L->hookcount = L->basehookcount)
 

Functions

LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, const char *opname)
 
LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2)
 
LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2)
 
LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2)
 
LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt,...)
 
LUAI_FUNC void luaG_errormsg (lua_State *L)
 
LUAI_FUNC int luaG_checkcode (const Proto *pt)
 
LUAI_FUNC int luaG_checkopenop (Instruction i)
 

Macro Definition Documentation

◆ getline

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

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

Referenced by currentline(), PrintCode(), and traceexec().

◆ pcRel

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

◆ resethookcount

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

Function Documentation

◆ luaG_aritherror()

LUAI_FUNC void 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)

◆ luaG_checkcode()

LUAI_FUNC int luaG_checkcode ( const Proto * pt)

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

484 {
485 return (symbexec(pt, pt->sizecode, NO_REG) != 0);
486}
static Instruction symbexec(const Proto *pt, int lastpc, int reg)
#define NO_REG

References NO_REG, Proto::sizecode, and symbexec().

Referenced by close_func(), and LoadFunction().

◆ luaG_checkopenop()

LUAI_FUNC int luaG_checkopenop ( Instruction i)

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

290 {
291 switch (GET_OPCODE(i)) {
292 case OP_CALL:
293 case OP_TAILCALL:
294 case OP_RETURN:
295 case OP_SETLIST: {
296 check(GETARG_B(i) == 0);
297 return 1;
298 }
299 default: return 0; /* invalid instruction after an open call */
300 }
301}
#define check(x)
#define GETARG_B(i)
#define GET_OPCODE(i)

References check, GET_OPCODE, GETARG_B, OP_CALL, OP_RETURN, OP_SETLIST, and OP_TAILCALL.

Referenced by luaV_execute().

◆ luaG_concaterror()

LUAI_FUNC void 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)

◆ luaG_errormsg()

LUAI_FUNC void 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 int 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 void 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 void 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