ltm.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. ** $Id: ltm.h,v 1.11 2000/03/20 19:14:54 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. };
  35. #define luaT_getim(L,tag,event) (&L->IMtable[tag].int_method[event])
  36. #define luaT_getimbyObj(L,o,e) (luaT_getim(L, luaT_effectivetag(L, o),(e)))
  37. extern const char *const luaT_eventname[];
  38. void luaT_init (lua_State *L);
  39. void luaT_realtag (lua_State *L, int tag);
  40. int luaT_effectivetag (lua_State *L, const TObject *o);
  41. void luaT_settagmethod (lua_State *L, int t, const char *event, TObject *func);
  42. const TObject *luaT_gettagmethod (lua_State *L, int t, const char *event);
  43. const char *luaT_travtagmethods (lua_State *L, int (*fn)(lua_State *, TObject *));
  44. int luaT_validevent (int t, int e); /* used by compatibility module */
  45. #endif