aboutsummaryrefslogtreecommitdiff
path: root/src/lua/ltm.h
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-06-22 16:50:40 +0800
committerLi Jin <dragon-fly@qq.com>2020-06-22 16:50:40 +0800
commitcd2b60b101a398cb9356d746364e70eaed1860f1 (patch)
treea1fe71b76faabc4883f16905a94164ce5c23e692 /src/lua/ltm.h
parent88c1052e700f38cf3d8ad82d469da4c487760b7e (diff)
downloadyuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.tar.gz
yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.tar.bz2
yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.zip
add support for local variable declared with attribute 'close' and 'const' for Lua 5.4.
Diffstat (limited to 'src/lua/ltm.h')
-rw-r--r--src/lua/ltm.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/lua/ltm.h b/src/lua/ltm.h
new file mode 100644
index 0000000..99b545e
--- /dev/null
+++ b/src/lua/ltm.h
@@ -0,0 +1,94 @@
1/*
2** $Id: ltm.h $
3** Tag methods
4** See Copyright Notice in lua.h
5*/
6
7#ifndef ltm_h
8#define ltm_h
9
10
11#include "lobject.h"
12
13
14/*
15* WARNING: if you change the order of this enumeration,
16* grep "ORDER TM" and "ORDER OP"
17*/
18typedef enum {
19 TM_INDEX,
20 TM_NEWINDEX,
21 TM_GC,
22 TM_MODE,
23 TM_LEN,
24 TM_EQ, /* last tag method with fast access */
25 TM_ADD,
26 TM_SUB,
27 TM_MUL,
28 TM_MOD,
29 TM_POW,
30 TM_DIV,
31 TM_IDIV,
32 TM_BAND,
33 TM_BOR,
34 TM_BXOR,
35 TM_SHL,
36 TM_SHR,
37 TM_UNM,
38 TM_BNOT,
39 TM_LT,
40 TM_LE,
41 TM_CONCAT,
42 TM_CALL,
43 TM_CLOSE,
44 TM_N /* number of elements in the enum */
45} TMS;
46
47
48/*
49** Test whether there is no tagmethod.
50** (Because tagmethods use raw accesses, the result may be an "empty" nil.)
51*/
52#define notm(tm) ttisnil(tm)
53
54
55#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
56 ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
57
58#define fasttm(l,et,e) gfasttm(G(l), et, e)
59
60#define ttypename(x) luaT_typenames_[(x) + 1]
61
62LUAI_DDEC(const char *const luaT_typenames_[LUA_TOTALTYPES];)
63
64
65LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o);
66
67LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
68LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
69 TMS event);
70LUAI_FUNC void luaT_init (lua_State *L);
71
72LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
73 const TValue *p2, const TValue *p3);
74LUAI_FUNC void luaT_callTMres (lua_State *L, const TValue *f,
75 const TValue *p1, const TValue *p2, StkId p3);
76LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
77 StkId res, TMS event);
78LUAI_FUNC void luaT_tryconcatTM (lua_State *L);
79LUAI_FUNC void luaT_trybinassocTM (lua_State *L, const TValue *p1,
80 const TValue *p2, int inv, StkId res, TMS event);
81LUAI_FUNC void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2,
82 int inv, StkId res, TMS event);
83LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1,
84 const TValue *p2, TMS event);
85LUAI_FUNC int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2,
86 int inv, int isfloat, TMS event);
87
88LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams,
89 struct CallInfo *ci, const Proto *p);
90LUAI_FUNC void luaT_getvarargs (lua_State *L, struct CallInfo *ci,
91 StkId where, int wanted);
92
93
94#endif