diff options
author | Li Jin <dragon-fly@qq.com> | 2021-04-21 09:36:25 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-04-21 09:36:25 +0800 |
commit | b7bdf7d5d36825a1a750a74641f6d374dec5d67a (patch) | |
tree | 6b27eb6590e07c07f378305c51d0f5e0779faa83 /src/3rdParty/lua/lfunc.h | |
parent | b86e5af605a170a3559df0165eac3cb6b665dc49 (diff) | |
download | yuescript-b7bdf7d5d36825a1a750a74641f6d374dec5d67a.tar.gz yuescript-b7bdf7d5d36825a1a750a74641f6d374dec5d67a.tar.bz2 yuescript-b7bdf7d5d36825a1a750a74641f6d374dec5d67a.zip |
adjust some folder levels.
Diffstat (limited to 'src/3rdParty/lua/lfunc.h')
-rw-r--r-- | src/3rdParty/lua/lfunc.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/3rdParty/lua/lfunc.h b/src/3rdParty/lua/lfunc.h new file mode 100644 index 0000000..dc1cebc --- /dev/null +++ b/src/3rdParty/lua/lfunc.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | ** $Id: lfunc.h $ | ||
3 | ** Auxiliary functions to manipulate prototypes and closures | ||
4 | ** See Copyright Notice in lua.h | ||
5 | */ | ||
6 | |||
7 | #ifndef lfunc_h | ||
8 | #define lfunc_h | ||
9 | |||
10 | |||
11 | #include "lobject.h" | ||
12 | |||
13 | |||
14 | #define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \ | ||
15 | cast_int(sizeof(TValue)) * (n)) | ||
16 | |||
17 | #define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \ | ||
18 | cast_int(sizeof(TValue *)) * (n)) | ||
19 | |||
20 | |||
21 | /* test whether thread is in 'twups' list */ | ||
22 | #define isintwups(L) (L->twups != L) | ||
23 | |||
24 | |||
25 | /* | ||
26 | ** maximum number of upvalues in a closure (both C and Lua). (Value | ||
27 | ** must fit in a VM register.) | ||
28 | */ | ||
29 | #define MAXUPVAL 255 | ||
30 | |||
31 | |||
32 | #define upisopen(up) ((up)->v != &(up)->u.value) | ||
33 | |||
34 | |||
35 | #define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v)) | ||
36 | |||
37 | |||
38 | /* | ||
39 | ** maximum number of misses before giving up the cache of closures | ||
40 | ** in prototypes | ||
41 | */ | ||
42 | #define MAXMISS 10 | ||
43 | |||
44 | |||
45 | |||
46 | /* special status to close upvalues preserving the top of the stack */ | ||
47 | #define CLOSEKTOP (-1) | ||
48 | |||
49 | |||
50 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); | ||
51 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals); | ||
52 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals); | ||
53 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); | ||
54 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); | ||
55 | LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); | ||
56 | LUAI_FUNC void luaF_closeupval (lua_State *L, StkId level); | ||
57 | LUAI_FUNC void luaF_close (lua_State *L, StkId level, int status, int yy); | ||
58 | LUAI_FUNC void luaF_unlinkupval (UpVal *uv); | ||
59 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); | ||
60 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, | ||
61 | int pc); | ||
62 | |||
63 | |||
64 | #endif | ||