ltm.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. ** $Id: ltm.h,v 1.4 1997/11/26 18:53:45 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_LE,
  28. IM_GT,
  29. IM_GE,
  30. IM_CONCAT,
  31. IM_GC,
  32. IM_FUNCTION
  33. } IMS;
  34. #define IM_N 18
  35. struct IM {
  36. TObject int_method[IM_N];
  37. };
  38. #define luaT_getim(tag,event) (&L->IMtable[-(tag)].int_method[event])
  39. #define luaT_getimbyObj(o,e) (luaT_getim(luaT_effectivetag(o),(e)))
  40. extern char *luaT_eventname[];
  41. void luaT_init (void);
  42. void luaT_realtag (int tag);
  43. int luaT_effectivetag (TObject *o);
  44. void luaT_settagmethod (int t, char *event, TObject *func);
  45. TObject *luaT_gettagmethod (int t, char *event);
  46. char *luaT_travtagmethods (int (*fn)(TObject *));
  47. void luaT_setfallback (void); /* only if LUA_COMPAT2_5 */
  48. #endif