1*0a6a1f1dSLionel Sambuc /* $NetBSD: ltm.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ 211be35a1SLionel Sambuc 311be35a1SLionel Sambuc /* 4*0a6a1f1dSLionel Sambuc ** Id: ltm.h,v 2.21 2014/10/25 11:50:46 roberto Exp 511be35a1SLionel Sambuc ** Tag methods 611be35a1SLionel Sambuc ** See Copyright Notice in lua.h 711be35a1SLionel Sambuc */ 811be35a1SLionel Sambuc 911be35a1SLionel Sambuc #ifndef ltm_h 1011be35a1SLionel Sambuc #define ltm_h 1111be35a1SLionel Sambuc 1211be35a1SLionel Sambuc 1311be35a1SLionel Sambuc #include "lobject.h" 1411be35a1SLionel Sambuc 1511be35a1SLionel Sambuc 1611be35a1SLionel Sambuc /* 1711be35a1SLionel Sambuc * WARNING: if you change the order of this enumeration, 18*0a6a1f1dSLionel Sambuc * grep "ORDER TM" and "ORDER OP" 1911be35a1SLionel Sambuc */ 2011be35a1SLionel Sambuc typedef enum { 2111be35a1SLionel Sambuc TM_INDEX, 2211be35a1SLionel Sambuc TM_NEWINDEX, 2311be35a1SLionel Sambuc TM_GC, 2411be35a1SLionel Sambuc TM_MODE, 25*0a6a1f1dSLionel Sambuc TM_LEN, 26*0a6a1f1dSLionel Sambuc TM_EQ, /* last tag method with fast access */ 2711be35a1SLionel Sambuc TM_ADD, 2811be35a1SLionel Sambuc TM_SUB, 2911be35a1SLionel Sambuc TM_MUL, 3011be35a1SLionel Sambuc TM_MOD, 31*0a6a1f1dSLionel Sambuc #ifndef _KERNEL 3211be35a1SLionel Sambuc TM_POW, 33*0a6a1f1dSLionel Sambuc TM_DIV, 34*0a6a1f1dSLionel Sambuc #endif 35*0a6a1f1dSLionel Sambuc TM_IDIV, 36*0a6a1f1dSLionel Sambuc TM_BAND, 37*0a6a1f1dSLionel Sambuc TM_BOR, 38*0a6a1f1dSLionel Sambuc TM_BXOR, 39*0a6a1f1dSLionel Sambuc TM_SHL, 40*0a6a1f1dSLionel Sambuc TM_SHR, 4111be35a1SLionel Sambuc TM_UNM, 42*0a6a1f1dSLionel Sambuc TM_BNOT, 4311be35a1SLionel Sambuc TM_LT, 4411be35a1SLionel Sambuc TM_LE, 4511be35a1SLionel Sambuc TM_CONCAT, 4611be35a1SLionel Sambuc TM_CALL, 4711be35a1SLionel Sambuc TM_N /* number of elements in the enum */ 4811be35a1SLionel Sambuc } TMS; 4911be35a1SLionel Sambuc 5011be35a1SLionel Sambuc 5111be35a1SLionel Sambuc 5211be35a1SLionel Sambuc #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 5311be35a1SLionel Sambuc ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 5411be35a1SLionel Sambuc 5511be35a1SLionel Sambuc #define fasttm(l,et,e) gfasttm(G(l), et, e) 5611be35a1SLionel Sambuc 57*0a6a1f1dSLionel Sambuc #define ttypename(x) luaT_typenames_[(x) + 1] 58*0a6a1f1dSLionel Sambuc #define objtypename(x) ttypename(ttnov(x)) 59*0a6a1f1dSLionel Sambuc 60*0a6a1f1dSLionel Sambuc LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; 6111be35a1SLionel Sambuc 6211be35a1SLionel Sambuc 6311be35a1SLionel Sambuc LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 6411be35a1SLionel Sambuc LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 6511be35a1SLionel Sambuc TMS event); 6611be35a1SLionel Sambuc LUAI_FUNC void luaT_init (lua_State *L); 6711be35a1SLionel Sambuc 68*0a6a1f1dSLionel Sambuc LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, 69*0a6a1f1dSLionel Sambuc const TValue *p2, TValue *p3, int hasres); 70*0a6a1f1dSLionel Sambuc LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, 71*0a6a1f1dSLionel Sambuc StkId res, TMS event); 72*0a6a1f1dSLionel Sambuc LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 73*0a6a1f1dSLionel Sambuc StkId res, TMS event); 74*0a6a1f1dSLionel Sambuc LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, 75*0a6a1f1dSLionel Sambuc const TValue *p2, TMS event); 76*0a6a1f1dSLionel Sambuc 77*0a6a1f1dSLionel Sambuc 78*0a6a1f1dSLionel Sambuc 7911be35a1SLionel Sambuc #endif 80