summaryrefslogtreecommitdiff
path: root/src/fallback.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fallback.h')
-rw-r--r--src/fallback.h72
1 files changed, 50 insertions, 22 deletions
diff --git a/src/fallback.h b/src/fallback.h
index 71f150f7..7e314c9f 100644
--- a/src/fallback.h
+++ b/src/fallback.h
@@ -1,5 +1,5 @@
/*
-** $Id: fallback.h,v 1.13 1996/04/25 14:10:00 roberto Exp $
+** $Id: fallback.h,v 1.23 1997/04/24 22:59:57 roberto Exp $
*/
#ifndef fallback_h
@@ -8,30 +8,58 @@
#include "lua.h"
#include "opcode.h"
-extern struct FB {
- char *kind;
- Object function;
- int nParams;
- int nResults;
-} luaI_fallBacks[];
-
-#define FB_ERROR 0
-#define FB_INDEX 1
-#define FB_GETTABLE 2
-#define FB_ARITH 3
-#define FB_ORDER 4
-#define FB_CONCAT 5
-#define FB_SETTABLE 6
-#define FB_GC 7
-#define FB_FUNCTION 8
-#define FB_GETGLOBAL 9
+/*
+* WARNING: if you change the order of this enumeration,
+* grep "ORDER IM"
+*/
+typedef enum {
+ IM_GETTABLE = 0,
+ IM_SETTABLE,
+ IM_INDEX,
+ IM_GETGLOBAL,
+ IM_SETGLOBAL,
+ IM_ADD,
+ IM_SUB,
+ IM_MUL,
+ IM_DIV,
+ IM_POW,
+ IM_UNM,
+ IM_LT,
+ IM_LE,
+ IM_GT,
+ IM_GE,
+ IM_CONCAT,
+ IM_GC,
+ IM_FUNCTION
+} IMS;
+
+#define IM_N 18
+
+
+extern struct IM {
+ TObject int_method[IM_N];
+} *luaI_IMtable;
+
+extern char *luaI_eventname[];
+
+#define luaI_getim(tag,event) (&luaI_IMtable[-(tag)].int_method[event])
+#define luaI_getimbyObj(o,e) (luaI_getim(luaI_efectivetag(o),(e)))
void luaI_setfallback (void);
-int luaI_ref (Object *object, int lock);
-Object *luaI_getref (int ref);
-void luaI_travlock (int (*fn)(Object *));
+int luaI_ref (TObject *object, int lock);
+TObject *luaI_getref (int ref);
+void luaI_travlock (int (*fn)(TObject *));
void luaI_invalidaterefs (void);
-char *luaI_travfallbacks (int (*fn)(Object *));
+char *luaI_travfallbacks (int (*fn)(TObject *));
+
+void luaI_settag (int tag, TObject *o);
+void luaI_realtag (int tag);
+TObject *luaI_geterrorim (void);
+int luaI_efectivetag (TObject *o);
+void luaI_settagmethod (void);
+void luaI_gettagmethod (void);
+void luaI_seterrormethod (void);
+void luaI_initfallbacks (void);
#endif