ltm.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $
  3. ** Tag methods
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef ltm_h
  7. #define ltm_h
  8. #include "lobject.h"
  9. /*
  10. * WARNING: if you change the order of this enumeration,
  11. * grep "ORDER TM"
  12. */
  13. typedef enum {
  14. TM_INDEX,
  15. TM_NEWINDEX,
  16. TM_GC,
  17. TM_MODE,
  18. TM_EQ, /* last tag method with `fast' access */
  19. TM_ADD,
  20. TM_SUB,
  21. TM_MUL,
  22. TM_DIV,
  23. TM_MOD,
  24. TM_POW,
  25. TM_UNM,
  26. TM_LEN,
  27. TM_LT,
  28. TM_LE,
  29. TM_CONCAT,
  30. TM_CALL,
  31. TM_N /* number of elements in the enum */
  32. } TMS;
  33. #define gfasttm(g,et,e) ((et) == NULL ? NULL : \
  34. !luaR_isrotable(et) && ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
  35. #define fasttm(l,et,e) gfasttm(G(l), et, e)
  36. LUAI_DATA const char *const luaT_typenames[];
  37. LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
  38. LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
  39. TMS event);
  40. LUAI_FUNC void luaT_init (lua_State *L);
  41. #endif