1 /* $NetBSD: ldo.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */
4 ** Id: ldo.h,v 2.22 2015/05/22 17:48:19 roberto Exp
5 ** Stack and Call structure of Lua
6 ** See Copyright Notice in lua.h
18 #define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \
19 luaD_growstack(L, n); else condmovestack(L);
22 #define incr_top(L) {L->top++; luaD_checkstack(L,0);}
24 #define savestack(L,p) ((char *)(p) - (char *)L->stack)
25 #define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
28 /* type of protected functions, to be ran by 'runprotected' */
29 typedef void (*Pfunc
) (lua_State
*L
, void *ud
);
31 LUAI_FUNC
int luaD_protectedparser (lua_State
*L
, ZIO
*z
, const char *name
,
33 LUAI_FUNC
void luaD_hook (lua_State
*L
, int event
, int line
);
34 LUAI_FUNC
int luaD_precall (lua_State
*L
, StkId func
, int nresults
);
35 LUAI_FUNC
void luaD_call (lua_State
*L
, StkId func
, int nResults
,
37 LUAI_FUNC
int luaD_pcall (lua_State
*L
, Pfunc func
, void *u
,
38 ptrdiff_t oldtop
, ptrdiff_t ef
);
39 LUAI_FUNC
int luaD_poscall (lua_State
*L
, StkId firstResult
, int nres
);
40 LUAI_FUNC
void luaD_reallocstack (lua_State
*L
, int newsize
);
41 LUAI_FUNC
void luaD_growstack (lua_State
*L
, int n
);
42 LUAI_FUNC
void luaD_shrinkstack (lua_State
*L
);
44 LUAI_FUNC l_noret
luaD_throw (lua_State
*L
, int errcode
);
45 LUAI_FUNC
int luaD_rawrunprotected (lua_State
*L
, Pfunc f
, void *ud
);