From 3f78664fde0d8208f34ed7c653a2d02da5d323ad Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 5 Jan 2012 01:22:19 +1000 Subject: Add a compiler stub. --- LuaSL/src/LuaSL.h | 3 ++- LuaSL/src/LuaSL_compile.c | 19 +++++++++++++++++++ LuaSL/src/LuaSL_main.c | 8 +++++++- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 LuaSL/src/LuaSL_compile.c (limited to 'LuaSL/src') diff --git a/LuaSL/src/LuaSL.h b/LuaSL/src/LuaSL.h index af87de5..2bb2b4a 100644 --- a/LuaSL/src/LuaSL.h +++ b/LuaSL/src/LuaSL.h @@ -55,7 +55,8 @@ typedef struct int logDom; } gameGlobals; -typedef void (*doSomething) (gameGlobals *game, unsigned char key); + +Eina_Bool compileLSL(gameGlobals *game, char *script); void loggingStartup(gameGlobals *game); char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c new file mode 100644 index 0000000..f4aa0c6 --- /dev/null +++ b/LuaSL/src/LuaSL_compile.c @@ -0,0 +1,19 @@ +#include "LuaSL.h" + + +Eina_Bool compileLSL(gameGlobals *game, char *script) +{ + Eina_Bool result = EINA_FALSE; + +// Parse the LSL script, validating it and reporting errors. + +// Take the result of the parse, and convert it into Lua source. +// Each LSL script becomes a Lua state. +// LSL states are handled as Lua tables, with each LSL state function being a table function in a common metatable. +// LL and OS functions are likely to be C functions. + +// Compile the Lua source by the Lua compiler. + + return result; +} + diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c index 29b04d6..9a6c256 100644 --- a/LuaSL/src/LuaSL_main.c +++ b/LuaSL/src/LuaSL_main.c @@ -104,7 +104,7 @@ main(int argc, char **argv) return -1; } game.canvas = ecore_evas_get(game.ee); - ecore_evas_title_set(game.ee, "LuaoSL test harness"); + ecore_evas_title_set(game.ee, "LuaSL test harness"); ecore_evas_show(game.ee); game.bg = evas_object_rectangle_add(game.canvas); @@ -160,6 +160,12 @@ main(int argc, char **argv) ecore_evas_callback_delete_request_set(game.ee, _on_delete); edje_object_signal_callback_add(game.edje, "*", "game_*", _edje_signal_cb, &game); + snprintf(buf, sizeof(buf), "%s/Test sim/objects/onefang's test bed/~run", PACKAGE_DATA_DIR); + if (compileLSL(&game, buf)) + PIm("Against all odds, the compile of %s worked! lol", buf); + else + PEm("The compile of %s failed, as expected!", buf); + ecore_main_loop_begin(); ecore_animator_del(ani); -- cgit v1.1