xref: /netbsd/external/mit/lua/dist/src/ltm.h (revision 6550d01e)
1 /*	$NetBSD: ltm.h,v 1.1.1.1 2010/10/31 11:17:00 mbalmer Exp $	*/
2 
3 /*
4 ** Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp
5 ** Tag methods
6 ** See Copyright Notice in lua.h
7 */
8 
9 #ifndef ltm_h
10 #define ltm_h
11 
12 
13 #include "lobject.h"
14 
15 
16 /*
17 * WARNING: if you change the order of this enumeration,
18 * grep "ORDER TM"
19 */
20 typedef enum {
21   TM_INDEX,
22   TM_NEWINDEX,
23   TM_GC,
24   TM_MODE,
25   TM_EQ,  /* last tag method with `fast' access */
26   TM_ADD,
27   TM_SUB,
28   TM_MUL,
29   TM_DIV,
30   TM_MOD,
31   TM_POW,
32   TM_UNM,
33   TM_LEN,
34   TM_LT,
35   TM_LE,
36   TM_CONCAT,
37   TM_CALL,
38   TM_N		/* number of elements in the enum */
39 } TMS;
40 
41 
42 
43 #define gfasttm(g,et,e) ((et) == NULL ? NULL : \
44   ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
45 
46 #define fasttm(l,et,e)	gfasttm(G(l), et, e)
47 
48 LUAI_DATA const char *const luaT_typenames[];
49 
50 
51 LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
52 LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
53                                                        TMS event);
54 LUAI_FUNC void luaT_init (lua_State *L);
55 
56 #endif
57