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