From 4c239ae7dbd4043935dba1c8adc2a2ac397b9d40 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 8 Nov 2009 22:08:09 -0800 Subject: Removing useless flags debug and compile now, and adding lua-interface-light.lua for default lua-interface-light.exe behavior. --- src/lua-interface.cpp | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'src/lua-interface.cpp') diff --git a/src/lua-interface.cpp b/src/lua-interface.cpp index c8e5c24..9bf0e91 100644 --- a/src/lua-interface.cpp +++ b/src/lua-interface.cpp @@ -89,6 +89,8 @@ extern void luaiup_init(Lua * L) WEAK; #endif #ifdef LUA_INTERFACE_LIGHT +extern unsigned int size_lua_interface_light_lua; +extern unsigned char lua_interface_light_lua[]; #define MODULES_BUILT_IN #define LIGHT "-light" #else @@ -524,8 +526,6 @@ struct option long_options[] = { {"help", 0, NULL, 'h'}, {"verbose", 0, NULL, 'v'}, {"archive", 1, NULL, 'a'}, - {"compile", 1, NULL, 'c'}, - {"debug", 0, NULL, 'd'}, {"interactive", 0, NULL, 'i'}, {"line", 0, NULL, 'l'}, {"exec", 1, NULL, 'e'}, @@ -666,8 +666,6 @@ void showhelp(bool longhelp = false) { "Options:\n" " -v for verbose mode.\n" " -a to load an additionnal archive file.\n" -" -c to dump the compiled byte code to file.\n" -" -d to enable debug mode (ie, do not strip)\n" " -i to start interactive mode.\n" " -l to turn off the exec on end line.\n" " -e to execute this single command in LUA.\n" @@ -846,8 +844,8 @@ void autoload_exports(Lua * L) { virtual int startup() throw (GeneralException) { char c; - bool strip = true, todo = false, write = false, builtin = false, daemonize = false; - char * file = 0, * output = 0, * compile = 0, * exec = 0; + bool todo = false, write = false, builtin = false, daemonize = false; + char * file = 0, * output = 0, * exec = 0; Lua * L = 0; String hport = "1500", tport = "1550", mport = "2500"; pthread_t interactive_thread; @@ -860,7 +858,7 @@ virtual int startup() throw (GeneralException) { /* Let's start parsing options */ - while ((c = getopt_long(argc, argv, "Hhva:c:dile:bg:m::s::t::f:z", long_options, NULL)) != EOF) { + while ((c = getopt_long(argc, argv, "Hhva:ile:bg:m::s::t::f:z", long_options, NULL)) != EOF) { switch (c) { case 'h': case 'H': @@ -873,12 +871,6 @@ virtual int startup() throw (GeneralException) { case 'a': new Archive(optarg); break; - case 'c': - compile = strdup(optarg); - break; - case 'd': - strip = false; - break; case 'i': interactive = true; todo = true; @@ -951,8 +943,8 @@ virtual int startup() throw (GeneralException) { showjitstatus(L); - /* Loading lua-interface.lua (only when not compiling) */ - if (!compile && !builtin) { + /* Loading lua-interface.lua */ + if (!builtin) { try { L->load(&Input("lua-interface.lua")); } @@ -962,7 +954,7 @@ virtual int startup() throw (GeneralException) { } } - if (!compile && builtin) { + if (builtin) { Buffer built; built.write(lua_interface_lua, size_lua_interface_lua); @@ -980,16 +972,21 @@ virtual int startup() throw (GeneralException) { L->load(&Input(argv[optind++]), !compile); } - /* Doh... */ if (!todo) { +#ifdef LUA_INTERFACE_LIGHT + Buffer built; + built.write(lua_interface_light_lua, size_lua_interface_light_lua); + + try { + L->load(&built); + } + catch (GeneralException e) { + printm(M_WARNING, "There was an error loading built-in lua-interface-light.lua: %s\n", e.GetMsg()); + } +#else showhelp(); throw Exit(0); - } - - /* Compilation process will exit from itself right after */ - if (compile) { - L->dump(&Output(compile), strip); - throw Exit(0); +#endif } /* One shot command */ -- cgit v1.2.3