summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/ldo.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/ldo.h')
-rw-r--r--apps/plugins/lua/ldo.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/apps/plugins/lua/ldo.h b/apps/plugins/lua/ldo.h
index d3d3082c9b..4c97134805 100644
--- a/apps/plugins/lua/ldo.h
+++ b/apps/plugins/lua/ldo.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.h,v 2.20.1.1 2013/04/12 18:48:47 roberto Exp $ 2** $Id$
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -13,34 +13,45 @@
13#include "lzio.h" 13#include "lzio.h"
14 14
15 15
16#define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ 16#define luaD_checkstack(L,n) \
17 luaD_growstack(L, n); else condmovestack(L); 17 if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
18 luaD_growstack(L, n); \
19 else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
18 20
19 21
20#define incr_top(L) {L->top++; luaD_checkstack(L,0);} 22#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
21 23
22#define savestack(L,p) ((char *)(p) - (char *)L->stack) 24#define savestack(L,p) ((char *)(p) - (char *)L->stack)
23#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) 25#define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
24 26
27#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
28#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
29
30
31/* results from luaD_precall */
32#define PCRLUA 0 /* initiated a call to a Lua function */
33#define PCRC 1 /* did a call to a C function */
34#define PCRYIELD 2 /* C funtion yielded */
35
25 36
26/* type of protected functions, to be ran by `runprotected' */ 37/* type of protected functions, to be ran by `runprotected' */
27typedef void (*Pfunc) (lua_State *L, void *ud); 38typedef void (*Pfunc) (lua_State *L, void *ud);
28 39
29LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, 40LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
30 const char *mode); 41LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
31LUAI_FUNC void luaD_hook (lua_State *L, int event, int line);
32LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); 42LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
33LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults, 43LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
34 int allowyield);
35LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 44LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
36 ptrdiff_t oldtop, ptrdiff_t ef); 45 ptrdiff_t oldtop, ptrdiff_t ef);
37LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); 46LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
47LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
38LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 48LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
39LUAI_FUNC void luaD_growstack (lua_State *L, int n); 49LUAI_FUNC void luaD_growstack (lua_State *L, int n);
40LUAI_FUNC void luaD_shrinkstack (lua_State *L);
41 50
42LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); 51LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
43LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 52LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
44 53
54LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
55
45#endif 56#endif
46 57