aboutsummaryrefslogtreecommitdiff
path: root/src/lua/ldo.h
diff options
context:
space:
mode:
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' */
37typedef void (*Pfunc) (lua_State *L, void *ud); 51typedef void (*Pfunc) (lua_State *L, void *ud);
38 52
53LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
39LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, 54LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
40 const char *mode); 55 const char *mode);
41LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); 56LUAI_FUNC void luaD_hook (lua_State *L, int event, int line,
42LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); 57 int fTransfer, int nTransfer);
58LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci);
59LUAI_FUNC void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n);
43LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 60LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
44LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); 61LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults);
62LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func);
45LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 63LUAI_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);
47LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, 65LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, int nres);
48 int nres); 66LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int raiseerror);
49LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 67LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror);
50LUAI_FUNC void luaD_growstack (lua_State *L, int n);
51LUAI_FUNC void luaD_shrinkstack (lua_State *L); 68LUAI_FUNC void luaD_shrinkstack (lua_State *L);
52LUAI_FUNC void luaD_inctop (lua_State *L); 69LUAI_FUNC void luaD_inctop (lua_State *L);
53 70