ltm.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. ** $Id: ltm.h,v 1.37 2002/06/25 19:17:22 roberto Exp roberto $
  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. ** Important: garbage collection uses two extra bits of `Table.flags'
  11. ** (after TM_MODE), so the maximum number of `fast tag methods' is six
  12. ** (at least while `flags' is a byte).
  13. */
  14. /*
  15. * WARNING: if you change the order of this enumeration,
  16. * grep "ORDER TM"
  17. */
  18. typedef enum {
  19. TM_INDEX,
  20. TM_NEWINDEX,
  21. TM_GC,
  22. TM_EQ,
  23. TM_MODE, /* last tag method with `fast' access */
  24. TM_GETTABLE,
  25. TM_SETTABLE,
  26. TM_ADD,
  27. TM_SUB,
  28. TM_MUL,
  29. TM_DIV,
  30. TM_POW,
  31. TM_UNM,
  32. TM_LT,
  33. TM_LE,
  34. TM_CONCAT,
  35. TM_CALL,
  36. TM_N /* number of elements in the enum */
  37. } TMS;
  38. #define fasttm(l,et,e) \
  39. (((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, G(l)->tmname[e]))
  40. const TObject *luaT_gettm (Table *events, TMS event, TString *ename);
  41. const TObject *luaT_gettmbyobj (lua_State *L, const TObject *o, TMS event);
  42. void luaT_init (lua_State *L);
  43. extern const char *const luaT_typenames[];
  44. #endif