xref: /freebsd/sys/contrib/openzfs/module/lua/ldo.h (revision 994297b01b98816bea1abf45ae4bac1bc69ee7a0)
1 /* BEGIN CSTYLED */
2 /*
3 ** $Id: ldo.h,v 2.20.1.1 2013/04/12 18:48:47 roberto Exp $
4 ** Stack and Call structure of Lua
5 ** See Copyright Notice in lua.h
6 */
7 
8 #ifndef ldo_h
9 #define ldo_h
10 
11 
12 #include "lobject.h"
13 #include "lstate.h"
14 #include "lzio.h"
15 
16 
17 #define luaD_checkstack(L,n)	if (L->stack_last - L->top <= (n)) \
18 				    luaD_growstack(L, n); else condmovestack(L);
19 
20 
21 #define incr_top(L) {L->top++; luaD_checkstack(L,0);}
22 
23 #define savestack(L,p)		((char *)(p) - (char *)L->stack)
24 #define restorestack(L,n)	((TValue *)((char *)L->stack + (n)))
25 
26 
27 /* type of protected functions, to be ran by `runprotected' */
28 typedef void (*Pfunc) (lua_State *L, void *ud);
29 
30 LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
31                                                   const char *mode);
32 LUAI_FUNC void luaD_hook (lua_State *L, int event, int line);
33 LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
34 LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults,
35                                         int allowyield);
36 LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
37                                         ptrdiff_t oldtop, ptrdiff_t ef);
38 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
39 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
40 LUAI_FUNC void luaD_growstack (lua_State *L, int n);
41 LUAI_FUNC void luaD_shrinkstack (lua_State *L);
42 
43 LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);
44 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
45 
46 #endif
47 /* END CSTYLED */
48