diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-06-22 16:50:40 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-06-22 16:50:40 +0800 |
| commit | cd2b60b101a398cb9356d746364e70eaed1860f1 (patch) | |
| tree | a1fe71b76faabc4883f16905a94164ce5c23e692 /src/lua/ldo.h | |
| parent | 88c1052e700f38cf3d8ad82d469da4c487760b7e (diff) | |
| download | yuescript-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 '')
| -rw-r--r-- | src/lua/ldo.h (renamed from src/lua-5.3/ldo.h) | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/lua-5.3/ldo.h b/src/lua/ldo.h index 3b2983a..7760f85 100644 --- a/src/lua-5.3/ldo.h +++ b/src/lua/ldo.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.h,v 2.29.1.1 2017/04/19 17:20:42 roberto Exp $ | 2 | ** $Id: ldo.h $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -22,7 +22,8 @@ | |||
| 22 | */ | 22 | */ |
| 23 | #define luaD_checkstackaux(L,n,pre,pos) \ | 23 | #define luaD_checkstackaux(L,n,pre,pos) \ |
| 24 | if (L->stack_last - L->top <= (n)) \ | 24 | if (L->stack_last - L->top <= (n)) \ |
| 25 | { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } | 25 | { pre; luaD_growstack(L, n, 1); pos; } \ |
| 26 | else { condmovestack(L,pre,pos); } | ||
| 26 | 27 | ||
| 27 | /* In general, 'pre'/'pos' are empty (nothing to save) */ | 28 | /* In general, 'pre'/'pos' are empty (nothing to save) */ |
| 28 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) | 29 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) |
| @@ -30,24 +31,40 @@ | |||
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) | 33 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) |
| 33 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) | 34 | #define restorestack(L,n) ((StkId)((char *)L->stack + (n))) |
| 35 | |||
| 36 | |||
| 37 | /* macro to check stack size, preserving 'p' */ | ||
| 38 | #define checkstackp(L,n,p) \ | ||
| 39 | luaD_checkstackaux(L, n, \ | ||
| 40 | ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ | ||
| 41 | luaC_checkGC(L), /* stack grow uses memory */ \ | ||
| 42 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ | ||
| 43 | |||
| 44 | |||
| 45 | /* macro to check stack size and GC */ | ||
| 46 | #define checkstackGC(L,fsize) \ | ||
| 47 | luaD_checkstackaux(L, (fsize), (void)0, luaC_checkGC(L)) | ||
| 34 | 48 | ||
| 35 | 49 | ||
| 36 | /* type of protected functions, to be ran by 'runprotected' */ | 50 | /* type of protected functions, to be ran by 'runprotected' */ |
| 37 | typedef void (*Pfunc) (lua_State *L, void *ud); | 51 | typedef void (*Pfunc) (lua_State *L, void *ud); |
| 38 | 52 | ||
| 53 | LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); | ||
| 39 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, | 54 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, |
| 40 | const char *mode); | 55 | const char *mode); |
| 41 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); | 56 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, |
| 42 | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); | 57 | int fTransfer, int nTransfer); |
| 58 | LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); | ||
| 59 | LUAI_FUNC void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n); | ||
| 43 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); | 60 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); |
| 44 | LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); | 61 | LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); |
| 62 | LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func); | ||
| 45 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, | 63 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, |
| 46 | ptrdiff_t oldtop, ptrdiff_t ef); | 64 | ptrdiff_t oldtop, ptrdiff_t ef); |
| 47 | LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, | 65 | LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, int nres); |
| 48 | int nres); | 66 | LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int raiseerror); |
| 49 | LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); | 67 | LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror); |
| 50 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); | ||
| 51 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); | 68 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); |
| 52 | LUAI_FUNC void luaD_inctop (lua_State *L); | 69 | LUAI_FUNC void luaD_inctop (lua_State *L); |
| 53 | 70 | ||
