summaryrefslogtreecommitdiff
path: root/etc/noparser.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2010-01-08 12:00:00 +0000
committerrepogen <>2010-01-08 12:00:00 +0000
commit22912c77c80f8de8f7accd3319c726f7c5349fd3 (patch)
treecaf064ecca31cd2ef1c919c585ee6b3d5e6d25d6 /etc/noparser.c
parent300cd56eb905be061aa75bb665549b3b85109bbe (diff)
downloadlua-github-22912c77c80f8de8f7accd3319c726f7c5349fd3.tar.gz
Lua 5.2.0-work15.2.0-work1
Diffstat (limited to 'etc/noparser.c')
-rw-r--r--etc/noparser.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/etc/noparser.c b/etc/noparser.c
index 13ba5462..5e0e2031 100644
--- a/etc/noparser.c
+++ b/etc/noparser.c
@@ -4,16 +4,24 @@
* You'll only be able to load binary files and strings, precompiled with luac.
* (Of course, you'll have to build luac with the original parsing modules!)
*
-* To use this module, simply compile it ("make noparser" does that) and list
-* its object file before the Lua libraries. The linker should then not load
-* the parsing modules. To try it, do "make luab".
+* To use this module, simply compile it and list its object file before the
+* Lua libraries. The linker should then not load the parsing modules.
*
-* If you also want to avoid the dump module (ldump.o), define NODUMP.
-* #define NODUMP
+* If you want to avoid the dump module or the undump modules, use the
+* corresponding #define below.
+*
+#define NOPARSER
+#define NODUMP
+#define NOUNDUMP
*/
+#define NOPARSER
+
#define LUA_CORE
+#include "lua.h"
+/* --------------------------------------------------------------- noparser */
+#ifdef NOPARSER
#include "llex.h"
#include "lparser.h"
#include "lzio.h"
@@ -22,7 +30,7 @@ LUAI_FUNC void luaX_init (lua_State *L) {
UNUSED(L);
}
-LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
+LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, Varlist *varl, const char *name) {
UNUSED(z);
UNUSED(buff);
UNUSED(name);
@@ -30,7 +38,9 @@ LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *n
lua_error(L);
return NULL;
}
+#endif
+/* --------------------------------------------------------------- nodump */
#ifdef NODUMP
#include "lundump.h"
@@ -39,12 +49,22 @@ LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data,
UNUSED(w);
UNUSED(data);
UNUSED(strip);
-#if 1
- UNUSED(L);
- return 0;
-#else
lua_pushliteral(L,"dumper not loaded");
lua_error(L);
+ return 0;
+}
#endif
+
+/* --------------------------------------------------------------- noundump */
+#ifdef NOUNDUMP
+#include "lundump.h"
+
+LUAI_FUNC Proto *luaU_undump (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
+ UNUSED(z);
+ UNUSED(buff);
+ UNUSED(name);
+ lua_pushliteral(L,"cannot load binary chunks");
+ lua_error(L);
+ return NULL;
}
#endif