aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-05 01:22:19 +1000
committerDavid Walter Seikel2012-01-05 01:22:19 +1000
commit3f78664fde0d8208f34ed7c653a2d02da5d323ad (patch)
tree47c1b3e28f5d61ed8c2c90de952181da6f2a2fc0
parentMove the object files out of the source directory. (diff)
downloadSledjHamr-3f78664fde0d8208f34ed7c653a2d02da5d323ad.zip
SledjHamr-3f78664fde0d8208f34ed7c653a2d02da5d323ad.tar.gz
SledjHamr-3f78664fde0d8208f34ed7c653a2d02da5d323ad.tar.bz2
SledjHamr-3f78664fde0d8208f34ed7c653a2d02da5d323ad.tar.xz
Add a compiler stub.
Diffstat (limited to '')
-rw-r--r--LuaSL/README18
-rwxr-xr-xLuaSL/build.sh2
-rw-r--r--LuaSL/src/LuaSL.h3
-rw-r--r--LuaSL/src/LuaSL_compile.c19
-rw-r--r--LuaSL/src/LuaSL_main.c8
5 files changed, 47 insertions, 3 deletions
diff --git a/LuaSL/README b/LuaSL/README
index a882bfc..b8edefc 100644
--- a/LuaSL/README
+++ b/LuaSL/README
@@ -63,3 +63,21 @@ Performance testing will have to be done on 5000 scripts, to see how
63that compares against XEngine. 63that compares against XEngine.
64 64
65 65
66Parser.
67-------
68
69The SL viewer code includes a flex/bison based parser that generates C++
70code that depends on various other bits of LL source code. It's GPL 2,
71though the flex and bison source files includes no license text.
72
73Flex is BSD and written in C. Bison is GNU (GPL 3 since 2.4.1, 2.3 is
74GPL2) and written in C. It used to include info that stuff generated by
75bison had to be GPL. Berkeley YACC is public domain, and written in C.
76There is also btyacc, based on the berkeley version, but with some
77useful extras. btyacc version 3 (the version coming from my version of
78Ubuntu) apparently no longer supports C, only C++. It's written in C
79though.
80
81Let's see if flex and btyacc will do the trick, and output C.
82
83Might be best to have the LSL to Lua converter as a seperate executable.
diff --git a/LuaSL/build.sh b/LuaSL/build.sh
index 29558dd..6aba3a0 100755
--- a/LuaSL/build.sh
+++ b/LuaSL/build.sh
@@ -47,7 +47,7 @@ libs="-lecore -levas -ledje -leet -leina"
47#-lrt \ 47#-lrt \
48#-lz 48#-lz
49 49
50names="LuaSL_main LuaSL_utilities" 50names="LuaSL_main LuaSL_compile LuaSL_utilities"
51 51
52EDJE_FLAGS="-id images -fd fonts" 52EDJE_FLAGS="-id images -fd fonts"
53 53
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
55 int logDom; 55 int logDom;
56} gameGlobals; 56} gameGlobals;
57 57
58typedef void (*doSomething) (gameGlobals *game, unsigned char key); 58
59Eina_Bool compileLSL(gameGlobals *game, char *script);
59 60
60void loggingStartup(gameGlobals *game); 61void loggingStartup(gameGlobals *game);
61char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); 62char *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 @@
1#include "LuaSL.h"
2
3
4Eina_Bool compileLSL(gameGlobals *game, char *script)
5{
6 Eina_Bool result = EINA_FALSE;
7
8// Parse the LSL script, validating it and reporting errors.
9
10// Take the result of the parse, and convert it into Lua source.
11// Each LSL script becomes a Lua state.
12// LSL states are handled as Lua tables, with each LSL state function being a table function in a common metatable.
13// LL and OS functions are likely to be C functions.
14
15// Compile the Lua source by the Lua compiler.
16
17 return result;
18}
19
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)
104 return -1; 104 return -1;
105 } 105 }
106 game.canvas = ecore_evas_get(game.ee); 106 game.canvas = ecore_evas_get(game.ee);
107 ecore_evas_title_set(game.ee, "LuaoSL test harness"); 107 ecore_evas_title_set(game.ee, "LuaSL test harness");
108 ecore_evas_show(game.ee); 108 ecore_evas_show(game.ee);
109 109
110 game.bg = evas_object_rectangle_add(game.canvas); 110 game.bg = evas_object_rectangle_add(game.canvas);
@@ -160,6 +160,12 @@ main(int argc, char **argv)
160 ecore_evas_callback_delete_request_set(game.ee, _on_delete); 160 ecore_evas_callback_delete_request_set(game.ee, _on_delete);
161 edje_object_signal_callback_add(game.edje, "*", "game_*", _edje_signal_cb, &game); 161 edje_object_signal_callback_add(game.edje, "*", "game_*", _edje_signal_cb, &game);
162 162
163 snprintf(buf, sizeof(buf), "%s/Test sim/objects/onefang's test bed/~run", PACKAGE_DATA_DIR);
164 if (compileLSL(&game, buf))
165 PIm("Against all odds, the compile of %s worked! lol", buf);
166 else
167 PEm("The compile of %s failed, as expected!", buf);
168
163 ecore_main_loop_begin(); 169 ecore_main_loop_begin();
164 170
165 ecore_animator_del(ani); 171 ecore_animator_del(ani);