ltm.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. ** $Id: ltm.h,v 2.22 2016/02/26 19:20:15 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" and "ORDER OP"
  12. */
  13. typedef enum {
  14. TM_INDEX,
  15. TM_NEWINDEX,
  16. TM_GC,
  17. TM_MODE,
  18. TM_LEN,
  19. TM_EQ, /* last tag method with fast access */
  20. TM_ADD,
  21. TM_SUB,
  22. TM_MUL,
  23. TM_MOD,
  24. TM_POW,
  25. TM_DIV,
  26. TM_IDIV,
  27. TM_BAND,
  28. TM_BOR,
  29. TM_BXOR,
  30. TM_SHL,
  31. TM_SHR,
  32. TM_UNM,
  33. TM_BNOT,
  34. TM_LT,
  35. TM_LE,
  36. TM_CONCAT,
  37. TM_CALL,
  38. TM_N /* number of elements in the enum */
  39. } TMS;
  40. #define gfasttm(g,et,e) ((et) == NULL ? NULL : \
  41. ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
  42. #define fasttm(l,et,e) gfasttm(G(l), et, e)
  43. #define ttypename(x) luaT_typenames_[(x) + 1]
  44. LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];
  45. LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o);
  46. LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
  47. LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
  48. TMS event);
  49. LUAI_FUNC void luaT_init (lua_State *L);
  50. LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
  51. const TValue *p2, TValue *p3, int hasres);
  52. LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
  53. StkId res, TMS event);
  54. LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
  55. StkId res, TMS event);
  56. LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1,
  57. const TValue *p2, TMS event);
  58. #endif