diff options
Diffstat (limited to 'src/lj_meta.h')
-rw-r--r-- | src/lj_meta.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lj_meta.h b/src/lj_meta.h new file mode 100644 index 00000000..60d1e79e --- /dev/null +++ b/src/lj_meta.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | ** Metamethod handling. | ||
3 | ** Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h | ||
4 | */ | ||
5 | |||
6 | #ifndef _LJ_META_H | ||
7 | #define _LJ_META_H | ||
8 | |||
9 | #include "lj_obj.h" | ||
10 | |||
11 | /* Metamethod handling */ | ||
12 | LJ_FUNC void lj_meta_init(lua_State *L); | ||
13 | LJ_FUNC cTValue *lj_meta_cache(GCtab *mt, MMS mm, GCstr *name); | ||
14 | LJ_FUNC cTValue *lj_meta_lookup(lua_State *L, cTValue *o, MMS mm); | ||
15 | |||
16 | #define lj_meta_fastg(g, mt, mm) \ | ||
17 | ((mt) == NULL ? NULL : ((mt)->nomm & (1u<<(mm))) ? NULL : \ | ||
18 | lj_meta_cache(mt, mm, strref((g)->mmname[mm]))) | ||
19 | #define lj_meta_fast(L, mt, mm) lj_meta_fastg(G(L), mt, mm) | ||
20 | |||
21 | /* C helpers for some instructions, called from assembler VM. */ | ||
22 | LJ_FUNCA cTValue *lj_meta_tget(lua_State *L, cTValue *o, cTValue *k); | ||
23 | LJ_FUNCA TValue *lj_meta_tset(lua_State *L, cTValue *o, cTValue *k); | ||
24 | LJ_FUNCA TValue *lj_meta_arith(lua_State *L, TValue *ra, cTValue *rb, | ||
25 | cTValue *rc, BCReg op); | ||
26 | LJ_FUNCA TValue *lj_meta_cat(lua_State *L, TValue *top, int left); | ||
27 | LJ_FUNCA TValue *lj_meta_len(lua_State *L, cTValue *o); | ||
28 | LJ_FUNCA TValue *lj_meta_equal(lua_State *L, GCobj *o1, GCobj *o2, int ne); | ||
29 | LJ_FUNCA TValue *lj_meta_comp(lua_State *L, cTValue *o1, cTValue *o2, int op); | ||
30 | LJ_FUNCA void lj_meta_call(lua_State *L, TValue *func, TValue *top); | ||
31 | LJ_FUNCA void lj_meta_for(lua_State *L, TValue *base); | ||
32 | |||
33 | #endif | ||