ltm.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. ** $Id: ltm.h,v 1.14 2000/08/07 20:21:34 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. #include "lstate.h"
  10. /*
  11. * WARNING: if you change the order of this enumeration,
  12. * grep "ORDER IM"
  13. */
  14. typedef enum {
  15. IM_GETTABLE = 0,
  16. IM_SETTABLE,
  17. IM_INDEX,
  18. IM_GETGLOBAL,
  19. IM_SETGLOBAL,
  20. IM_ADD,
  21. IM_SUB,
  22. IM_MUL,
  23. IM_DIV,
  24. IM_POW,
  25. IM_UNM,
  26. IM_LT,
  27. IM_CONCAT,
  28. IM_GC,
  29. IM_FUNCTION,
  30. IM_N /* number of elements in the enum */
  31. } IMS;
  32. struct IM {
  33. TObject int_method[IM_N];
  34. TString *collected; /* list of G. collected udata with this tag */
  35. };
  36. #define luaT_getim(L,tag,event) (&L->IMtable[tag].int_method[event])
  37. #define luaT_getimbyObj(L,o,e) (luaT_getim(L, luaT_effectivetag(L, o),(e)))
  38. extern const char *const luaT_eventname[];
  39. void luaT_init (lua_State *L);
  40. void luaT_realtag (lua_State *L, int tag);
  41. int luaT_effectivetag (lua_State *L, const TObject *o);
  42. int luaT_validevent (int t, int e); /* used by compatibility module */
  43. #endif