1 /* BEGIN CSTYLED */ 2 /* 3 ** $Id: ltm.h,v 2.11.1.1 2013/04/12 18:48:47 roberto Exp $ 4 ** Tag methods 5 ** See Copyright Notice in lua.h 6 */ 7 8 #ifndef ltm_h 9 #define ltm_h 10 11 12 #include "lobject.h" 13 14 15 /* 16 * WARNING: if you change the order of this enumeration, 17 * grep "ORDER TM" 18 */ 19 typedef enum { 20 TM_INDEX, 21 TM_NEWINDEX, 22 TM_GC, 23 TM_MODE, 24 TM_LEN, 25 TM_EQ, /* last tag method with `fast' access */ 26 TM_ADD, 27 TM_SUB, 28 TM_MUL, 29 TM_DIV, 30 TM_MOD, 31 TM_POW, 32 TM_UNM, 33 TM_LT, 34 TM_LE, 35 TM_CONCAT, 36 TM_CALL, 37 TM_N /* number of elements in the enum */ 38 } TMS; 39 40 41 42 #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 43 ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 44 45 #define fasttm(l,et,e) gfasttm(G(l), et, e) 46 47 #define ttypename(x) luaT_typenames_[(x) + 1] 48 #define objtypename(x) ttypename(ttypenv(x)) 49 50 LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; 51 52 53 LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 54 LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 55 TMS event); 56 LUAI_FUNC void luaT_init (lua_State *L); 57 58 #endif 59 /* END CSTYLED */ 60