etc/protocols - sync with NetBSD-8
[minix.git] / external / mit / lua / dist / src / ltm.h
blob2a097d8cff615122e13d448d0a6e697d40a3ff1c
1 /* $NetBSD: ltm.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */
3 /*
4 ** Id: ltm.h,v 2.21 2014/10/25 11:50:46 roberto Exp
5 ** Tag methods
6 ** See Copyright Notice in lua.h
7 */
9 #ifndef ltm_h
10 #define ltm_h
13 #include "lobject.h"
17 * WARNING: if you change the order of this enumeration,
18 * grep "ORDER TM" and "ORDER OP"
20 typedef enum {
21 TM_INDEX,
22 TM_NEWINDEX,
23 TM_GC,
24 TM_MODE,
25 TM_LEN,
26 TM_EQ, /* last tag method with fast access */
27 TM_ADD,
28 TM_SUB,
29 TM_MUL,
30 TM_MOD,
31 #ifndef _KERNEL
32 TM_POW,
33 TM_DIV,
34 #endif
35 TM_IDIV,
36 TM_BAND,
37 TM_BOR,
38 TM_BXOR,
39 TM_SHL,
40 TM_SHR,
41 TM_UNM,
42 TM_BNOT,
43 TM_LT,
44 TM_LE,
45 TM_CONCAT,
46 TM_CALL,
47 TM_N /* number of elements in the enum */
48 } TMS;
52 #define gfasttm(g,et,e) ((et) == NULL ? NULL : \
53 ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
55 #define fasttm(l,et,e) gfasttm(G(l), et, e)
57 #define ttypename(x) luaT_typenames_[(x) + 1]
58 #define objtypename(x) ttypename(ttnov(x))
60 LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];
63 LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
64 LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
65 TMS event);
66 LUAI_FUNC void luaT_init (lua_State *L);
68 LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
69 const TValue *p2, TValue *p3, int hasres);
70 LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
71 StkId res, TMS event);
72 LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
73 StkId res, TMS event);
74 LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1,
75 const TValue *p2, TMS event);
79 #endif