1997-09-17 03:25:59 +08:00
|
|
|
/*
|
2000-10-05 20:14:08 +08:00
|
|
|
** $Id: ltm.h,v 1.16 2000/10/03 14:27:44 roberto Exp roberto $
|
1997-09-17 03:25:59 +08:00
|
|
|
** Tag methods
|
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ltm_h
|
|
|
|
#define ltm_h
|
|
|
|
|
|
|
|
|
|
|
|
#include "lobject.h"
|
1997-11-20 01:29:23 +08:00
|
|
|
#include "lstate.h"
|
1997-09-17 03:25:59 +08: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 22:58:26 +08:00
|
|
|
IM_FUNCTION,
|
|
|
|
IM_N /* number of elements in the enum */
|
1997-09-17 03:25:59 +08:00
|
|
|
} IMS;
|
|
|
|
|
|
|
|
|
1997-11-20 01:29:23 +08:00
|
|
|
struct IM {
|
1997-09-17 03:25:59 +08:00
|
|
|
TObject int_method[IM_N];
|
2000-05-31 02:54:49 +08:00
|
|
|
TString *collected; /* list of G. collected udata with this tag */
|
1997-11-20 01:29:23 +08:00
|
|
|
};
|
1997-09-17 03:25:59 +08:00
|
|
|
|
|
|
|
|
2000-03-21 03:14:54 +08:00
|
|
|
#define luaT_getim(L,tag,event) (&L->IMtable[tag].int_method[event])
|
2000-10-05 20:14:08 +08: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-17 03:25:59 +08:00
|
|
|
|
1999-08-17 04:52:00 +08:00
|
|
|
extern const char *const luaT_eventname[];
|
1997-09-17 03:25:59 +08:00
|
|
|
|
|
|
|
|
1999-11-22 21:12:07 +08:00
|
|
|
void luaT_init (lua_State *L);
|
|
|
|
void luaT_realtag (lua_State *L, int tag);
|
2000-10-05 20:14:08 +08:00
|
|
|
int luaT_tag (const TObject *o);
|
2000-03-31 00:41:51 +08:00
|
|
|
int luaT_validevent (int t, int e); /* used by compatibility module */
|
1997-09-17 03:25:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|