diff options
| author | 2025-12-07 12:44:18 +0100 | |
|---|---|---|
| committer | 2025-12-07 12:44:18 +0100 | |
| commit | 6a335e2b7d47afdb5e37034a095aaa26a34d7ee1 (patch) | |
| tree | b7aae9d679df13ce04f695670e80a8e7a73361c9 /test/external/lua-5.4.0/src/lapi.h | |
| parent | bfc6b66078ab3ec543b8355ad22df1c423bf9a8c (diff) | |
Add lua 5.4.0 test suite
Diffstat (limited to 'test/external/lua-5.4.0/src/lapi.h')
| -rw-r--r-- | test/external/lua-5.4.0/src/lapi.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/external/lua-5.4.0/src/lapi.h b/test/external/lua-5.4.0/src/lapi.h new file mode 100644 index 0000000..41216b2 --- /dev/null +++ b/test/external/lua-5.4.0/src/lapi.h @@ -0,0 +1,47 @@ +/* +** $Id: lapi.h $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "llimits.h" +#include "lstate.h" + + +/* Increments 'L->top', checking for stack overflows */ +#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ + "stack overflow");} + + +/* +** If a call returns too many multiple returns, the callee may not have +** stack space to accommodate all results. In this case, this macro +** increases its stack space ('L->ci->top'). +*/ +#define adjustresults(L,nres) \ + { if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } + + +/* Ensure the stack has at least 'n' elements */ +#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ + "not enough elements in the stack") + + +/* +** To reduce the overhead of returning from C functions, the presence of +** to-be-closed variables in these functions is coded in the CallInfo's +** field 'nresults', in a way that functions with no to-be-closed variables +** with zero, one, or "all" wanted results have no overhead. Functions +** with other number of wanted results, as well as functions with +** variables to be closed, have an extra check. +*/ + +#define hastocloseCfunc(n) ((n) < LUA_MULTRET) + +#define codeNresults(n) (-(n) - 3) + +#endif |