18e3e3a7aSWarner Losh /* 20495ed39SKyle Evans ** $Id: ldebug.h $ 38e3e3a7aSWarner Losh ** Auxiliary functions from Debug Interface module 48e3e3a7aSWarner Losh ** See Copyright Notice in lua.h 58e3e3a7aSWarner Losh */ 68e3e3a7aSWarner Losh 78e3e3a7aSWarner Losh #ifndef ldebug_h 88e3e3a7aSWarner Losh #define ldebug_h 98e3e3a7aSWarner Losh 108e3e3a7aSWarner Losh 118e3e3a7aSWarner Losh #include "lstate.h" 128e3e3a7aSWarner Losh 138e3e3a7aSWarner Losh 140495ed39SKyle Evans #define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1) 158e3e3a7aSWarner Losh 160495ed39SKyle Evans 170495ed39SKyle Evans /* Active Lua function (given call info) */ 18*a9490b81SWarner Losh #define ci_func(ci) (clLvalue(s2v((ci)->func.p))) 190495ed39SKyle Evans 208e3e3a7aSWarner Losh 218e3e3a7aSWarner Losh #define resethookcount(L) (L->hookcount = L->basehookcount) 228e3e3a7aSWarner Losh 230495ed39SKyle Evans /* 240495ed39SKyle Evans ** mark for entries in 'lineinfo' array that has absolute information in 250495ed39SKyle Evans ** 'abslineinfo' array 260495ed39SKyle Evans */ 270495ed39SKyle Evans #define ABSLINEINFO (-0x80) 288e3e3a7aSWarner Losh 298c784bb8SWarner Losh 308c784bb8SWarner Losh /* 318c784bb8SWarner Losh ** MAXimum number of successive Instructions WiTHout ABSolute line 328c784bb8SWarner Losh ** information. (A power of two allows fast divisions.) 338c784bb8SWarner Losh */ 348c784bb8SWarner Losh #if !defined(MAXIWTHABS) 358c784bb8SWarner Losh #define MAXIWTHABS 128 368c784bb8SWarner Losh #endif 378c784bb8SWarner Losh 388c784bb8SWarner Losh 390495ed39SKyle Evans LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc); 400495ed39SKyle Evans LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, 410495ed39SKyle Evans StkId *pos); 428e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, 438e3e3a7aSWarner Losh const char *opname); 448c784bb8SWarner Losh LUAI_FUNC l_noret luaG_callerror (lua_State *L, const TValue *o); 450495ed39SKyle Evans LUAI_FUNC l_noret luaG_forerror (lua_State *L, const TValue *o, 460495ed39SKyle Evans const char *what); 478e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 488e3e3a7aSWarner Losh const TValue *p2); 498e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, 508e3e3a7aSWarner Losh const TValue *p2, 518e3e3a7aSWarner Losh const char *msg); 528e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 538e3e3a7aSWarner Losh const TValue *p2); 548e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 558e3e3a7aSWarner Losh const TValue *p2); 568e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); 578e3e3a7aSWarner Losh LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, 588e3e3a7aSWarner Losh TString *src, int line); 598e3e3a7aSWarner Losh LUAI_FUNC l_noret luaG_errormsg (lua_State *L); 600495ed39SKyle Evans LUAI_FUNC int luaG_traceexec (lua_State *L, const Instruction *pc); 618e3e3a7aSWarner Losh 628e3e3a7aSWarner Losh 638e3e3a7aSWarner Losh #endif 64