1997-09-16 16:25:59 -03:00
|
|
|
/*
|
2000-10-05 09:14:08 -03:00
|
|
|
** $Id: ltm.h,v 1.16 2000/10/03 14:27:44 roberto Exp roberto $
|
1997-09-16 16:25:59 -03:00
|
|
|
** Tag methods
|
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ltm_h
|
|
|
|
#define ltm_h
|
|
|
|
|
|
|
|
|
|
|
|
#include "lobject.h"
|
1997-11-19 15:29:23 -02:00
|
|
|
#include "lstate.h"
|
1997-09-16 16:25:59 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* WARNING: if you change the order of this enumeration,
|
|
|
|
* grep "ORDER IM"
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
IM_GETTABLE = 0,
|
|
|
|
IM_SETTABLE,
|
|
|
|
IM_INDEX,
|
|
|
|
IM_GETGLOBAL,
|
|
|
|
IM_SETGLOBAL,
|
|
|
|
IM_ADD,
|
|
|
|
IM_SUB,
|
|
|
|
IM_MUL,
|
|
|
|
IM_DIV,
|
|
|
|
IM_POW,
|
|
|
|
IM_UNM,
|
|
|
|
IM_LT,
|
|
|
|
IM_CONCAT,
|
|
|
|
IM_GC,
|
2000-03-03 11:58:26 -03:00
|
|
|
IM_FUNCTION,
|
|
|
|
IM_N /* number of elements in the enum */
|
1997-09-16 16:25:59 -03:00
|
|
|
} IMS;
|
|
|
|
|
|
|
|
|
1997-11-19 15:29:23 -02:00
|
|
|
struct IM {
|
1997-09-16 16:25:59 -03:00
|
|
|
TObject int_method[IM_N];
|
2000-05-30 15:54:49 -03:00
|
|
|
TString *collected; /* list of G. collected udata with this tag */
|
1997-11-19 15:29:23 -02:00
|
|
|
};
|
1997-09-16 16:25:59 -03:00
|
|
|
|
|
|
|
|
2000-03-20 16:14:54 -03:00
|
|
|
#define luaT_getim(L,tag,event) (&L->IMtable[tag].int_method[event])
|
2000-10-05 09:14:08 -03:00
|
|
|
#define luaT_getimbyObj(L,o,e) (luaT_getim((L),luaT_tag(o),(e)))
|
|
|
|
|
|
|
|
|
|
|
|
#define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag)
|
1997-09-16 16:25:59 -03:00
|
|
|
|
1999-08-16 17:52:00 -03:00
|
|
|
extern const char *const luaT_eventname[];
|
1997-09-16 16:25:59 -03:00
|
|
|
|
|
|
|
|
1999-11-22 11:12:07 -02:00
|
|
|
void luaT_init (lua_State *L);
|
|
|
|
void luaT_realtag (lua_State *L, int tag);
|
2000-10-05 09:14:08 -03:00
|
|
|
int luaT_tag (const TObject *o);
|
2000-03-30 13:41:51 -03:00
|
|
|
int luaT_validevent (int t, int e); /* used by compatibility module */
|
1997-09-16 16:25:59 -03:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|