2 ** $Id: ldo.h,v 2.29.1.1 2017/04/19 17:20:42 roberto Exp $
3 ** Stack and Call structure of Lua
4 ** See Copyright Notice in lua.h
17 ** Macro to check stack size and grow stack if needed. Parameters
18 ** 'pre'/'pos' allow the macro to preserve a pointer into the
19 ** stack across reallocations, doing the work only when needed.
20 ** 'condmovestack' is used in heavy tests to force a stack reallocation
23 #define luaD_checkstackaux(L,n,pre,pos) \
24 if (L->stack_last - L->top <= (n)) \
25 { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); }
27 /* In general, 'pre'/'pos' are empty (nothing to save) */
28 #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0)
32 #define savestack(L,p) ((char *)(p) - (char *)L->stack)
33 #define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
36 /* type of protected functions, to be ran by 'runprotected' */
37 typedef void (*Pfunc
) (lua_State
*L
, void *ud
);
39 LUAI_FUNC
int luaD_protectedparser (lua_State
*L
, ZIO
*z
, const char *name
,
41 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
);
43 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
);
45 LUAI_FUNC
int luaD_pcall (lua_State
*L
, Pfunc func
, void *u
,
46 ptrdiff_t oldtop
, ptrdiff_t ef
);
47 LUAI_FUNC
int luaD_poscall (lua_State
*L
, CallInfo
*ci
, StkId firstResult
,
49 LUAI_FUNC
void luaD_reallocstack (lua_State
*L
, int newsize
);
50 LUAI_FUNC
void luaD_growstack (lua_State
*L
, int n
);
51 LUAI_FUNC
void luaD_shrinkstack (lua_State
*L
);
52 LUAI_FUNC
void luaD_inctop (lua_State
*L
);
54 LUAI_FUNC l_noret
luaD_throw (lua_State
*L
, int errcode
);
55 LUAI_FUNC
int luaD_rawrunprotected (lua_State
*L
, Pfunc f
, void *ud
);