Home | History | Annotate | Line # | Download | only in src
      1 /*	$NetBSD: ldebug.h,v 1.11 2023/06/08 21:12:08 nikita Exp $	*/
      2 
      3 /*
      4 ** Id: ldebug.h
      5 ** Auxiliary functions from Debug Interface module
      6 ** See Copyright Notice in lua.h
      7 */
      8 
      9 #ifndef ldebug_h
     10 #define ldebug_h
     11 
     12 
     13 #include "lstate.h"
     14 
     15 
     16 #define pcRel(pc, p)	(cast_int((pc) - (p)->code) - 1)
     17 
     18 
     19 /* Active Lua function (given call info) */
     20 #define ci_func(ci)		(clLvalue(s2v((ci)->func.p)))
     21 
     22 
     23 #define resethookcount(L)	(L->hookcount = L->basehookcount)
     24 
     25 /*
     26 ** mark for entries in 'lineinfo' array that has absolute information in
     27 ** 'abslineinfo' array
     28 */
     29 #define ABSLINEINFO	(-0x80)
     30 
     31 
     32 /*
     33 ** MAXimum number of successive Instructions WiTHout ABSolute line
     34 ** information. (A power of two allows fast divisions.)
     35 */
     36 #if !defined(MAXIWTHABS)
     37 #define MAXIWTHABS	128
     38 #endif
     39 
     40 
     41 LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc);
     42 LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
     43                                                     StkId *pos);
     44 LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
     45                                                 const char *opname);
     46 LUAI_FUNC l_noret luaG_callerror (lua_State *L, const TValue *o);
     47 LUAI_FUNC l_noret luaG_forerror (lua_State *L, const TValue *o,
     48                                                const char *what);
     49 LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1,
     50                                                   const TValue *p2);
     51 LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1,
     52                                                  const TValue *p2,
     53                                                  const char *msg);
     54 LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1,
     55                                                  const TValue *p2);
     56 LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1,
     57                                                  const TValue *p2);
     58 LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...);
     59 LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg,
     60                                                   TString *src, int line);
     61 LUAI_FUNC l_noret luaG_errormsg (lua_State *L);
     62 LUAI_FUNC int luaG_traceexec (lua_State *L, const Instruction *pc);
     63 
     64 
     65 #endif
     66