tag methods are always functions, so don't need to store a whole object
This commit is contained in:
48
ltm.h
48
ltm.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltm.h,v 1.16 2000/10/03 14:27:44 roberto Exp roberto $
|
||||
** $Id: ltm.h,v 1.17 2000/10/05 12:14:08 roberto Exp roberto $
|
||||
** Tag methods
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -13,36 +13,36 @@
|
||||
|
||||
/*
|
||||
* WARNING: if you change the order of this enumeration,
|
||||
* grep "ORDER IM"
|
||||
* grep "ORDER TM"
|
||||
*/
|
||||
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,
|
||||
IM_FUNCTION,
|
||||
IM_N /* number of elements in the enum */
|
||||
} IMS;
|
||||
TM_GETTABLE = 0,
|
||||
TM_SETTABLE,
|
||||
TM_INDEX,
|
||||
TM_GETGLOBAL,
|
||||
TM_SETGLOBAL,
|
||||
TM_ADD,
|
||||
TM_SUB,
|
||||
TM_MUL,
|
||||
TM_DIV,
|
||||
TM_POW,
|
||||
TM_UNM,
|
||||
TM_LT,
|
||||
TM_CONCAT,
|
||||
TM_GC,
|
||||
TM_FUNCTION,
|
||||
TM_N /* number of elements in the enum */
|
||||
} TMS;
|
||||
|
||||
|
||||
struct IM {
|
||||
TObject int_method[IM_N];
|
||||
TString *collected; /* list of G. collected udata with this tag */
|
||||
struct TM {
|
||||
Closure *method[TM_N];
|
||||
TString *collected; /* list of garbage-collected udata with this tag */
|
||||
};
|
||||
|
||||
|
||||
#define luaT_getim(L,tag,event) (&L->IMtable[tag].int_method[event])
|
||||
#define luaT_getimbyObj(L,o,e) (luaT_getim((L),luaT_tag(o),(e)))
|
||||
#define luaT_gettm(L,tag,event) (L->TMtable[tag].method[event])
|
||||
#define luaT_gettmbyObj(L,o,e) (luaT_gettm((L),luaT_tag(o),(e)))
|
||||
|
||||
|
||||
#define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag)
|
||||
|
||||
Reference in New Issue
Block a user