new names for debug types

This commit is contained in:
Roberto Ierusalimschy 2000-03-30 14:19:48 -03:00
parent e2c60eda16
commit 556a89e537
8 changed files with 49 additions and 49 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.25 2000/01/19 12:00:45 roberto Exp roberto $
** $Id: lauxlib.c,v 1.26 2000/02/08 16:34:31 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -31,7 +31,7 @@ int luaL_findstring (const char *name, const char *const list[]) {
}
void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
lua_Dbgactreg ar;
lua_Debug ar;
lua_getstack(L, 0, &ar);
lua_getinfo(L, "nu", &ar);
narg -= ar.nups;

View File

@ -1,5 +1,5 @@
/*
** $Id: ldblib.c,v 1.10 2000/01/19 12:00:45 roberto Exp roberto $
** $Id: ldblib.c,v 1.11 2000/03/03 14:58:26 roberto Exp roberto $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@ -42,7 +42,7 @@ static void settabso (lua_State *L, lua_Object t, const char *i, lua_Object v) {
static void getstack (lua_State *L) {
lua_Dbgactreg ar;
lua_Debug ar;
if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */
return;
else {
@ -79,8 +79,8 @@ static void getstack (lua_State *L) {
static void getlocal (lua_State *L) {
lua_Dbgactreg ar;
lua_Dbglocvar lvar;
lua_Debug ar;
lua_Localvar lvar;
if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */
luaL_argerror(L, 1, "level out of range");
lvar.index = luaL_check_int(L, 2);
@ -92,8 +92,8 @@ static void getlocal (lua_State *L) {
static void setlocal (lua_State *L) {
lua_Dbgactreg ar;
lua_Dbglocvar lvar;
lua_Debug ar;
lua_Localvar lvar;
if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */
luaL_argerror(L, 1, "level out of range");
lvar.index = luaL_check_int(L, 2);
@ -113,7 +113,7 @@ static int callhook = LUA_NOREF; /* Lua reference to call hook function */
static void linef (lua_State *L, lua_Dbgactreg *ar) {
static void linef (lua_State *L, lua_Debug *ar) {
if (linehook != LUA_NOREF) {
lua_pushnumber(L, ar->currentline);
lua_callfunction(L, lua_getref(L, linehook));
@ -121,7 +121,7 @@ static void linef (lua_State *L, lua_Dbgactreg *ar) {
}
static void callf (lua_State *L, lua_Dbgactreg *ar) {
static void callf (lua_State *L, lua_Debug *ar) {
if (callhook != LUA_NOREF) {
lua_pushstring(L, ar->event);
lua_callfunction(L, lua_getref(L, callhook));

View File

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 1.13 2000/03/27 20:10:21 roberto Exp roberto $
** $Id: ldebug.c,v 1.14 2000/03/29 20:19:20 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -41,15 +41,15 @@ static int hasdebuginfo (lua_State *L, StkId f) {
}
lua_Dbghook lua_setcallhook (lua_State *L, lua_Dbghook func) {
lua_Dbghook oldhook = L->callhook;
lua_Hook lua_setcallhook (lua_State *L, lua_Hook func) {
lua_Hook oldhook = L->callhook;
L->callhook = func;
return oldhook;
}
lua_Dbghook lua_setlinehook (lua_State *L, lua_Dbghook func) {
lua_Dbghook oldhook = L->linehook;
lua_Hook lua_setlinehook (lua_State *L, lua_Hook func) {
lua_Hook oldhook = L->linehook;
L->linehook = func;
return oldhook;
}
@ -75,7 +75,7 @@ static StkId aux_stackedfunction (lua_State *L, int level, StkId top) {
}
int lua_getstack (lua_State *L, int level, lua_Dbgactreg *ar) {
int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
StkId f = aux_stackedfunction(L, level, L->top);
if (f == NULL) return 0; /* there is no such level */
else {
@ -106,7 +106,7 @@ static Proto *getluaproto (StkId f) {
}
int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
int lua_getlocal (lua_State *L, const lua_Debug *ar, lua_Localvar *v) {
StkId f = ar->_func;
Proto *fp = getluaproto(f);
if (!fp) return 0; /* `f' is not a Lua function? */
@ -120,7 +120,7 @@ int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
}
int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
int lua_setlocal (lua_State *L, const lua_Debug *ar, lua_Localvar *v) {
StkId f = ar->_func;
Proto *fp = getluaproto(f);
if (!fp) return 0; /* `f' is not a Lua function? */
@ -132,7 +132,7 @@ int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
}
static void lua_funcinfo (lua_Dbgactreg *ar) {
static void lua_funcinfo (lua_Debug *ar) {
StkId func = ar->_func;
switch (ttype(func)) {
case TAG_LCLOSURE: case TAG_LCLMARK:
@ -158,7 +158,7 @@ static int checkfunc (lua_State *L, TObject *o) {
}
static void lua_getobjname (lua_State *L, StkId f, lua_Dbgactreg *ar) {
static void lua_getobjname (lua_State *L, StkId f, lua_Debug *ar) {
GlobalVar *g;
/* try to find a name for given function */
setnormalized(L->top, f); /* to be used by `checkfunc' */
@ -176,7 +176,7 @@ static void lua_getobjname (lua_State *L, StkId f, lua_Dbgactreg *ar) {
}
int lua_getinfo (lua_State *L, const char *what, lua_Dbgactreg *ar) {
int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
StkId func = ar->_func;
LUA_ASSERT(L, is_T_MARK(ttype(func)), "invalid activation record");
for (; *what; what++) {

12
ldo.c
View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 1.69 2000/03/10 18:37:44 roberto Exp roberto $
** $Id: ldo.c,v 1.70 2000/03/29 20:19:20 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -55,7 +55,7 @@ void luaD_checkstack (lua_State *L, int n) {
lua_error(L, "BAD STACK OVERFLOW! DATA CORRUPTED!");
}
else {
lua_Dbgactreg dummy;
lua_Debug dummy;
L->stack_last += EXTRA_STACK; /* to be used by error message */
if (lua_getstack(L, L->stacksize/SLOTS_PER_F, &dummy) == 0) {
/* too few funcs on stack: doesn't look like a recursion loop */
@ -103,7 +103,7 @@ void luaD_openstack (lua_State *L, StkId pos) {
void luaD_lineHook (lua_State *L, StkId func, int line) {
if (L->allowhooks) {
lua_Dbgactreg ar;
lua_Debug ar;
struct C_Lua_Stack oldCLS = L->Cstack;
StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->top;
L->Cstack.num = 0;
@ -119,10 +119,10 @@ void luaD_lineHook (lua_State *L, StkId func, int line) {
}
static void luaD_callHook (lua_State *L, StkId func, lua_Dbghook callhook,
static void luaD_callHook (lua_State *L, StkId func, lua_Hook callhook,
const char *event) {
if (L->allowhooks) {
lua_Dbgactreg ar;
lua_Debug ar;
struct C_Lua_Stack oldCLS = L->Cstack;
StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->top;
L->Cstack.num = 0;
@ -179,7 +179,7 @@ void luaD_callTM (lua_State *L, const TObject *f, int nParams, int nResults) {
*/
void luaD_call (lua_State *L, StkId func, int nResults) {
StkId firstResult;
lua_Dbghook callhook = L->callhook;
lua_Hook callhook = L->callhook;
retry: /* for `function' tag method */
switch (ttype(func)) {
case TAG_LCLOSURE: {

View File

@ -1,5 +1,5 @@
/*
** $Id: liolib.c,v 1.59 2000/03/20 19:13:45 roberto Exp roberto $
** $Id: liolib.c,v 1.60 2000/03/22 16:24:13 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@ -536,7 +536,7 @@ static void io_debug (lua_State *L) {
static void errorfb (lua_State *L) {
char buff[MAXMESSAGE];
int level = 1; /* skip level 0 (it's this function) */
lua_Dbgactreg ar;
lua_Debug ar;
lua_Object alertfunc = lua_rawgetglobal(L, "_ALERT");
sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1)));
while (lua_getstack(L, level++, &ar)) {

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.h,v 1.29 2000/02/08 16:34:31 roberto Exp roberto $
** $Id: lstate.h,v 1.30 2000/03/10 18:37:44 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@ -76,8 +76,8 @@ struct lua_State {
unsigned long GCthreshold;
unsigned long nblocks; /* number of `blocks' currently allocated */
int debug;
lua_Dbghook callhook;
lua_Dbghook linehook;
lua_Hook callhook;
lua_Hook linehook;
int allowhooks;
};

10
lua.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.c,v 1.34 2000/03/03 14:58:26 roberto Exp roberto $
** $Id: lua.c,v 1.35 2000/03/20 20:27:32 roberto Exp roberto $
** Lua stand-alone interpreter
** See Copyright Notice in lua.h
*/
@ -30,8 +30,8 @@ typedef void (*handler)(int); /* type for signal actions */
static void laction (int i);
static lua_Dbghook old_linehook = NULL;
static lua_Dbghook old_callhook = NULL;
static lua_Hook old_linehook = NULL;
static lua_Hook old_callhook = NULL;
static handler lreset (void) {
@ -51,8 +51,8 @@ static void laction (int i) {
(void)i; /* to avoid warnings */
signal(SIGINT, SIG_DFL); /* if another SIGINT happens before lstop,
terminate process (default action) */
old_linehook = lua_setlinehook(lua_state, (lua_Dbghook)lstop);
old_callhook = lua_setcallhook(lua_state, (lua_Dbghook)lstop);
old_linehook = lua_setlinehook(lua_state, (lua_Hook)lstop);
old_callhook = lua_setcallhook(lua_state, (lua_Hook)lstop);
}

View File

@ -1,5 +1,5 @@
/*
** $Id: luadebug.h,v 1.8 1999/11/22 13:12:07 roberto Exp roberto $
** $Id: luadebug.h,v 1.9 2000/01/19 12:00:45 roberto Exp roberto $
** Debugging API
** See Copyright Notice in lua.h
*/
@ -11,25 +11,25 @@
#include "lua.h"
typedef struct lua_Dbgactreg lua_Dbgactreg; /* activation record */
typedef struct lua_Dbglocvar lua_Dbglocvar; /* local variable */
typedef struct lua_Debug lua_Debug; /* activation record */
typedef struct lua_Localvar lua_Localvar;
typedef void (*lua_Dbghook) (lua_State *L, lua_Dbgactreg *ar);
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
int lua_getstack (lua_State *L, int level, lua_Dbgactreg *ar);
int lua_getinfo (lua_State *L, const char *what, lua_Dbgactreg *ar);
int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v);
int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v);
int lua_getstack (lua_State *L, int level, lua_Debug *ar);
int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
int lua_getlocal (lua_State *L, const lua_Debug *ar, lua_Localvar *v);
int lua_setlocal (lua_State *L, const lua_Debug *ar, lua_Localvar *v);
int lua_setdebug (lua_State *L, int debug);
lua_Dbghook lua_setcallhook (lua_State *L, lua_Dbghook func);
lua_Dbghook lua_setlinehook (lua_State *L, lua_Dbghook func);
lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
struct lua_Dbgactreg {
struct lua_Debug {
const char *event; /* `call', `return' */
const char *source; /* (S) */
int linedefined; /* (S) */
@ -44,7 +44,7 @@ struct lua_Dbgactreg {
};
struct lua_Dbglocvar {
struct lua_Localvar {
int index;
const char *name;
lua_Object value;