From 845451a49fe822f4ccbf221e9b56889d5386713d Mon Sep 17 00:00:00 2001 From: pixel Date: Sat, 6 Dec 2003 04:26:15 +0000 Subject: Having LUA now in cd-tool! Yay! --- cd-tool.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'cd-tool.cpp') diff --git a/cd-tool.cpp b/cd-tool.cpp index 2886cc4..bf3d879 100644 --- a/cd-tool.cpp +++ b/cd-tool.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: cd-tool.cpp,v 1.15 2003-12-04 01:47:37 pixel Exp $ */ +/* $Id: cd-tool.cpp,v 1.16 2003-12-06 04:26:16 pixel Exp $ */ #include #include @@ -29,13 +29,14 @@ #include "Input.h" #include "Output.h" #include "Buffer.h" +#include "BLua.h" #include "cdreader.h" #include "cdutils.h" #include "generic.h" #include "Main.h" #include "cdabstract.h" - #include "isobuilder.h" +#include "luacd.h" int lga = 0; struct option long_options[] = { @@ -78,6 +79,7 @@ void showhelp(void) { " insert-file - insert the file to \n" " insert - insert some sectors at \n" " copy - copy to another iso\n" +" lua - interpret LUA script\n" "\n", argv[0]); } @@ -319,6 +321,23 @@ virtual int startup() throw (GeneralException) { delete o; o = 0; delete b; b = 0; delete buf; buf = 0; + } else if (!strcmp(argv[optind], "lua")) { + optind++; + if ((argc - 1) != optind) { + showhelp(); + printm(M_ERROR, "lua needs one argument.\n"); + throw Exit(-1); + } + arg1 = argv[optind]; + Lua * L = new Lua(); + LuaInput::pushconstruct(L); + LuaOutput::pushconstruct(L); + LuaBuffer::pushconstruct(L); + L->push("cdutil"); + Luacdutils lcdutil(cdutil); + lcdutil.push(L); + L->settable(LUA_GLOBALSINDEX); + L->load(&Input(arg1)); } else { showhelp(); printm(M_ERROR, "Command %s unknow.\n", argv[optind]); -- cgit v1.2.3