diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-05-21 19:01:41 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-05-21 19:01:41 +0000 |
commit | cf87597226f5d6b269f1f2c4d6f402aa1eccb852 (patch) | |
tree | 4ba1f3ae53b3bd9cae0e2c6c4dd57836b43a5ece /apps/plugins/lua/ldo.h | |
parent | c483efadc63eaed35b5fb5e4e02c2282daf32470 (diff) | |
download | rockbox-cf87597226f5d6b269f1f2c4d6f402aa1eccb852.tar.gz rockbox-cf87597226f5d6b269f1f2c4d6f402aa1eccb852.zip |
Commit FS#9174: Lua scripting language by Dan Everton
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21020 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lua/ldo.h')
-rw-r--r-- | apps/plugins/lua/ldo.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/apps/plugins/lua/ldo.h b/apps/plugins/lua/ldo.h new file mode 100644 index 0000000000..4c97134805 --- /dev/null +++ b/apps/plugins/lua/ldo.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | ** $Id$ | ||
3 | ** Stack and Call structure of Lua | ||
4 | ** See Copyright Notice in lua.h | ||
5 | */ | ||
6 | |||
7 | #ifndef ldo_h | ||
8 | #define ldo_h | ||
9 | |||
10 | |||
11 | #include "lobject.h" | ||
12 | #include "lstate.h" | ||
13 | #include "lzio.h" | ||
14 | |||
15 | |||
16 | #define luaD_checkstack(L,n) \ | ||
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)); | ||
20 | |||
21 | |||
22 | #define incr_top(L) {luaD_checkstack(L,1); L->top++;} | ||
23 | |||
24 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) | ||
25 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) | ||
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 | |||
36 | |||
37 | /* type of protected functions, to be ran by `runprotected' */ | ||
38 | typedef void (*Pfunc) (lua_State *L, void *ud); | ||
39 | |||
40 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); | ||
41 | LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); | ||
42 | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); | ||
43 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); | ||
44 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, | ||
45 | ptrdiff_t oldtop, ptrdiff_t ef); | ||
46 | LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); | ||
47 | LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); | ||
48 | LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); | ||
49 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); | ||
50 | |||
51 | LUAI_FUNC void luaD_throw (lua_State *L, int errcode); | ||
52 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); | ||
53 | |||
54 | LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); | ||
55 | |||
56 | #endif | ||
57 | |||