diff options
author | Lua Team <team@lua.org> | 2000-11-06 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2000-11-06 12:00:00 +0000 |
commit | 8cb71cb5548e3138e5d4e4744f52c79d9fafb116 (patch) | |
tree | 25859eb162c67eafc46866e0ec3a9a7ebf93157a /src/ltm.h | |
parent | b7610da5fed99f59ac73ae452da8839a0f2c1bda (diff) | |
download | lua-github-4.0.tar.gz |
Lua 4.04.0
Diffstat (limited to 'src/ltm.h')
-rw-r--r-- | src/ltm.h | 71 |
1 files changed, 34 insertions, 37 deletions
@@ -1,5 +1,5 @@ /* -** $Id: ltm.h,v 1.5 1999/01/15 13:11:57 roberto Exp $ +** $Id: ltm.h,v 1.18 2000/10/05 13:00:17 roberto Exp $ ** Tag methods ** See Copyright Notice in lua.h */ @@ -13,50 +13,47 @@ /* * 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_LE, - IM_GT, - IM_GE, - IM_CONCAT, - IM_GC, - IM_FUNCTION -} IMS; - -#define IM_N 18 - - -struct IM { - TObject int_method[IM_N]; + 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 TM { + Closure *method[TM_N]; + TString *collected; /* list of garbage-collected udata with this tag */ }; -#define luaT_getim(tag,event) (&L->IMtable[-(tag)].int_method[event]) -#define luaT_getimbyObj(o,e) (luaT_getim(luaT_effectivetag(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))) -extern char *luaT_eventname[]; +#define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag) -void luaT_init (void); -void luaT_realtag (int tag); -int luaT_effectivetag (TObject *o); -void luaT_settagmethod (int t, char *event, TObject *func); -TObject *luaT_gettagmethod (int t, char *event); -char *luaT_travtagmethods (int (*fn)(TObject *)); +extern const char *const luaT_eventname[]; + + +void luaT_init (lua_State *L); +void luaT_realtag (lua_State *L, int tag); +int luaT_tag (const TObject *o); +int luaT_validevent (int t, int e); /* used by compatibility module */ -void luaT_setfallback (void); /* only if LUA_COMPAT2_5 */ #endif |