avoid the use of "enum" in the API, as they do not have a fixed representation

This commit is contained in:
Roberto Ierusalimschy 2002-09-02 17:00:41 -03:00
parent 4964e7c8a0
commit 7c0ccdfd61
3 changed files with 17 additions and 9 deletions

4
ldo.c
View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 1.192 2002/08/07 20:55:00 roberto Exp roberto $
** $Id: ldo.c,v 1.193 2002/08/30 19:09:21 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -151,7 +151,7 @@ static void luaD_growCI (lua_State *L) {
}
void luaD_callhook (lua_State *L, lua_Hookevent event, int line) {
void luaD_callhook (lua_State *L, int event, int line) {
lua_Hook hook = L->hook;
if (hook && allowhook(L)) {
ptrdiff_t top = savestack(L, L->top);

4
ldo.h
View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.h,v 1.50 2002/08/06 15:32:22 roberto Exp roberto $
** $Id: ldo.h,v 1.51 2002/08/07 14:35:55 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -36,7 +36,7 @@ typedef void (*Pfunc) (lua_State *L, void *ud);
void luaD_resetprotection (lua_State *L);
int luaD_protectedparser (lua_State *L, ZIO *z, int bin);
void luaD_callhook (lua_State *L, lua_Hookevent event, int line);
void luaD_callhook (lua_State *L, int event, int line);
StkId luaD_precall (lua_State *L, StkId func);
void luaD_call (lua_State *L, StkId func, int nResults);
int luaD_pcall (lua_State *L, int nargs, int nresults, ptrdiff_t errfunc);

18
lua.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.155 2002/08/30 19:09:21 roberto Exp roberto $
** $Id: lua.h,v 1.156 2002/08/30 20:00:59 roberto Exp roberto $
** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org
@ -308,11 +308,19 @@ LUA_API int lua_pushupvalues (lua_State *L);
** =======================================================================
*/
typedef enum lua_Hookevent {
LUA_HOOKCALL, LUA_HOOKRET, LUA_HOOKLINE, LUA_HOOKCOUNT
} lua_Hookevent;
/*
** Event codes
*/
#define LUA_HOOKCALL 0
#define LUA_HOOKRET 1
#define LUA_HOOKLINE 2
#define LUA_HOOKCOUNT 3
/*
** Event masks
*/
#define LUA_MASKCALL (2 << LUA_HOOKCALL)
#define LUA_MASKRET (2 << LUA_HOOKRET)
#define LUA_MASKLINE (2 << LUA_HOOKLINE)
@ -339,7 +347,7 @@ LUA_API unsigned long lua_gethookmask (lua_State *L);
#define LUA_IDSIZE 60
struct lua_Debug {
lua_Hookevent event;
int event;
const char *name; /* (n) */
const char *namewhat; /* (n) `global', `local', `field', `method' */
const char *what; /* (S) `Lua' function, `C' function, Lua `main' */