release.sh changes & fixes
[minix3.git] / external / mit / lua / dist / src / ldo.h
blob37f2af42e6996b71ea61cebd8506e58bdbecb0f6
1 /* $NetBSD: ldo.h,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $ */
3 /*
4 ** $Id: ldo.h,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $
5 ** Stack and Call structure of Lua
6 ** See Copyright Notice in lua.h
7 */
9 #ifndef ldo_h
10 #define ldo_h
13 #include "lobject.h"
14 #include "lstate.h"
15 #include "lzio.h"
18 #define luaD_checkstack(L,n) \
19 if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
20 luaD_growstack(L, n); \
21 else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
24 #define incr_top(L) {luaD_checkstack(L,1); L->top++;}
26 #define savestack(L,p) ((char *)(p) - (char *)L->stack)
27 #define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
29 #define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
30 #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
33 /* results from luaD_precall */
34 #define PCRLUA 0 /* initiated a call to a Lua function */
35 #define PCRC 1 /* did a call to a C function */
36 #define PCRYIELD 2 /* C funtion yielded */
39 /* type of protected functions, to be ran by `runprotected' */
40 typedef void (*Pfunc) (lua_State *L, void *ud);
42 LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
43 LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
44 LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
45 LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
46 LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
47 ptrdiff_t oldtop, ptrdiff_t ef);
48 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
49 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
50 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
51 LUAI_FUNC void luaD_growstack (lua_State *L, int n);
53 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
54 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
56 LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
58 #endif