summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/lua/src/ldo.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-14 13:01:55 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-14 13:01:55 +0000
commit926c8ad88a5cce707fe1025f3551aa1c03318b32 (patch)
tree9d0c7d3102578adca5ab7381e3b1296f218270f8 /crawl-ref/source/util/lua/src/ldo.h
parent72560e17acd9fd40a9dcc969c14f3b1fd60fe96c (diff)
downloadcrawl-ref-926c8ad88a5cce707fe1025f3551aa1c03318b32.tar.gz
crawl-ref-926c8ad88a5cce707fe1025f3551aa1c03318b32.zip
Included Lua 5.1.2 source tree in crawl-ref/source/util. This is so we can use
Lua in core Crawl code without making Crawl harder to build (than it is already). Crawl's makefiles will call the Lua makefile if necessary (i.e., if liblua.a doesn't already exist). CLUA_BINDINGS is still not enabled by default (and will not be enabled by default in the source tree). Crawl will use two different Lua interpreter instances - one for user scripts (if CLUA_BINDINGS is defined), the other (not #ifdef conditionalised) for core game Lua glue. Lua is statically linked by default. We could change this if necessary, although the added size is only 200k. The Lua sources are almost unmodified; I've only added new targets for Crawl's platform-specific makefiles to call into to build liblua.a; I've not modified any existing targets, and all Lua READMEs and copyright notices are intact. Needs integration with Xcode build. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1305 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/util/lua/src/ldo.h')
-rw-r--r--crawl-ref/source/util/lua/src/ldo.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/crawl-ref/source/util/lua/src/ldo.h b/crawl-ref/source/util/lua/src/ldo.h
new file mode 100644
index 0000000000..b2de92bb80
--- /dev/null
+++ b/crawl-ref/source/util/lua/src/ldo.h
@@ -0,0 +1,57 @@
+/*
+** $Id: ldo.h,v 2.7 2005/08/24 16:15:49 roberto Exp $
+** Stack and Call structure of Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ldo_h
+#define ldo_h
+
+
+#include "lobject.h"
+#include "lstate.h"
+#include "lzio.h"
+
+
+#define luaD_checkstack(L,n) \
+ if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
+ luaD_growstack(L, n); \
+ else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
+
+
+#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
+
+#define savestack(L,p) ((char *)(p) - (char *)L->stack)
+#define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
+
+#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
+#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
+
+
+/* results from luaD_precall */
+#define PCRLUA 0 /* initiated a call to a Lua function */
+#define PCRC 1 /* did a call to a C function */
+#define PCRYIELD 2 /* C funtion yielded */
+
+
+/* type of protected functions, to be ran by `runprotected' */
+typedef void (*Pfunc) (lua_State *L, void *ud);
+
+LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
+LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
+LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
+LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
+LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
+ ptrdiff_t oldtop, ptrdiff_t ef);
+LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
+LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
+LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
+LUAI_FUNC void luaD_growstack (lua_State *L, int n);
+
+LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
+LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
+
+LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
+
+#endif
+