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' */
28typedef void (*Pfunc) (lua_State *L, void *ud);
29
30LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
31                                                  const char *mode);
32LUAI_FUNC void luaD_hook (lua_State *L, int event, int line);
33LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
34LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults,
35                                        int allowyield);
36LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
37                                        ptrdiff_t oldtop, ptrdiff_t ef);
38LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
39LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
40LUAI_FUNC void luaD_growstack (lua_State *L, int n);
41LUAI_FUNC void luaD_shrinkstack (lua_State *L);
42
43LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);
44LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
45
46#endif
47/* END CSTYLED */
48