diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-20 13:43:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-20 13:43:33 -0300 |
commit | 55ac40f859ad8e28fe71a8801d49f4a4140e8aa3 (patch) | |
tree | 1a1f02de45d28c7eb8976087ade773d7937bed14 /ldo.h | |
parent | 97ef8e7bd40340d47a9789beb06f0128d7438d0a (diff) | |
download | lua-55ac40f859ad8e28fe71a8801d49f4a4140e8aa3.tar.gz lua-55ac40f859ad8e28fe71a8801d49f4a4140e8aa3.tar.bz2 lua-55ac40f859ad8e28fe71a8801d49f4a4140e8aa3.zip |
Cleaning of llimits.h
Several definitions that don't need to be "global" (that is, that
concerns only specific parts of the code) moved out of llimits.h,
to more appropriate places.
Diffstat (limited to 'ldo.h')
-rw-r--r-- | ldo.h | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -23,10 +23,19 @@ | |||
23 | ** 'condmovestack' is used in heavy tests to force a stack reallocation | 23 | ** 'condmovestack' is used in heavy tests to force a stack reallocation |
24 | ** at every check. | 24 | ** at every check. |
25 | */ | 25 | */ |
26 | |||
27 | #if !defined(HARDSTACKTESTS) | ||
28 | #define condmovestack(L,pre,pos) ((void)0) | ||
29 | #else | ||
30 | /* realloc stack keeping its size */ | ||
31 | #define condmovestack(L,pre,pos) \ | ||
32 | { int sz_ = stacksize(L); pre; luaD_reallocstack((L), sz_, 0); pos; } | ||
33 | #endif | ||
34 | |||
26 | #define luaD_checkstackaux(L,n,pre,pos) \ | 35 | #define luaD_checkstackaux(L,n,pre,pos) \ |
27 | if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ | 36 | if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ |
28 | { pre; luaD_growstack(L, n, 1); pos; } \ | 37 | { pre; luaD_growstack(L, n, 1); pos; } \ |
29 | else { condmovestack(L,pre,pos); } | 38 | else { condmovestack(L,pre,pos); } |
30 | 39 | ||
31 | /* In general, 'pre'/'pos' are empty (nothing to save) */ | 40 | /* In general, 'pre'/'pos' are empty (nothing to save) */ |
32 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) | 41 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) |
@@ -44,6 +53,16 @@ | |||
44 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ | 53 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ |
45 | 54 | ||
46 | 55 | ||
56 | /* | ||
57 | ** Maximum depth for nested C calls, syntactical nested non-terminals, | ||
58 | ** and other features implemented through recursion in C. (Value must | ||
59 | ** fit in a 16-bit unsigned integer. It must also be compatible with | ||
60 | ** the size of the C stack.) | ||
61 | */ | ||
62 | #if !defined(LUAI_MAXCCALLS) | ||
63 | #define LUAI_MAXCCALLS 200 | ||
64 | #endif | ||
65 | |||
47 | 66 | ||
48 | /* type of protected functions, to be ran by 'runprotected' */ | 67 | /* type of protected functions, to be ran by 'runprotected' */ |
49 | typedef void (*Pfunc) (lua_State *L, void *ud); | 68 | typedef void (*Pfunc) (lua_State *L, void *ud); |