diff options
author | David Walter Seikel | 2016-01-18 20:40:18 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-01-18 20:40:18 +1000 |
commit | e7ce5bfec812467b33b8eb35476746ce142b4502 (patch) | |
tree | 2adcf7e1336ea6845ba2928fc412bff9cddd7cbe /src/LuaSL/LuaSL_main.c | |
parent | Adding some script engine test scripts, courtesy of LL, I think. (diff) | |
download | SledjHamr-e7ce5bfec812467b33b8eb35476746ce142b4502.zip SledjHamr-e7ce5bfec812467b33b8eb35476746ce142b4502.tar.gz SledjHamr-e7ce5bfec812467b33b8eb35476746ce142b4502.tar.bz2 SledjHamr-e7ce5bfec812467b33b8eb35476746ce142b4502.tar.xz |
Actually send compile messages back. Plus some refactoring of the script engine.
Diffstat (limited to '')
-rw-r--r-- | src/LuaSL/LuaSL_main.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 664cdd1..b72a155 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c | |||
@@ -228,7 +228,7 @@ static Eina_Bool parser(void *data, Connection *connection, char *SID, char *com | |||
228 | { | 228 | { |
229 | char *temp; | 229 | char *temp; |
230 | char *file; | 230 | char *file; |
231 | LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); | 231 | LuaCompiler *compiler; |
232 | 232 | ||
233 | strcpy(buf, &command[8]); | 233 | strcpy(buf, &command[8]); |
234 | temp = buf; | 234 | temp = buf; |
@@ -237,15 +237,10 @@ static Eina_Bool parser(void *data, Connection *connection, char *SID, char *com | |||
237 | temp++; | 237 | temp++; |
238 | temp[0] = '\0'; | 238 | temp[0] = '\0'; |
239 | 239 | ||
240 | eina_clist_init(&(compiler->messages)); | 240 | compiler = createCompiler(SID, file, (compileCb) compileLSL, _compileCb); |
241 | compiler->file = strdup(file); | ||
242 | compiler->SID = strdup(SID); | ||
243 | compiler->client = connection; | 241 | compiler->client = connection; |
244 | compiler->doConstants = FALSE; | 242 | PI("Compiling script %s", file); |
245 | compiler->parser = (compileCb) compileLSL; | 243 | compileScript(compiler, TRUE); |
246 | compiler->cb = _compileCb; | ||
247 | PD("Compiling script %s", file); | ||
248 | compileScript(compiler, COMPILE_THREADED); | ||
249 | } | 244 | } |
250 | else if (0 == strncmp(command, "run(", 4)) | 245 | else if (0 == strncmp(command, "run(", 4)) |
251 | { | 246 | { |
@@ -266,7 +261,7 @@ PD("Compiling script %s", file); | |||
266 | me = getScript(SID); | 261 | me = getScript(SID); |
267 | if (me) | 262 | if (me) |
268 | { | 263 | { |
269 | PD("Running script %s", me->fileName); | 264 | PI("Running script %s", me->fileName); |
270 | runScript(me); | 265 | runScript(me); |
271 | releaseScript(me); | 266 | releaseScript(me); |
272 | } | 267 | } |
@@ -311,13 +306,9 @@ int main(int argc, char **argv) | |||
311 | // get the arguments passed in | 306 | // get the arguments passed in |
312 | while (--argc > 0 && *++argv != '\0') | 307 | while (--argc > 0 && *++argv != '\0') |
313 | { | 308 | { |
314 | LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); | 309 | LuaCompiler *compiler; |
315 | 310 | ||
316 | eina_clist_init(&(compiler->messages)); | 311 | compiler = createCompiler("0", *argv, (compileCb) compileLSL, _compileCbSingle); |
317 | compiler->file = strdup(*argv); | ||
318 | compiler->SID = strdup("0"); | ||
319 | compiler->doConstants = FALSE; | ||
320 | compiler->parser = (compileCb) compileLSL; | ||
321 | compiler->cb = _compileCbSingle; | 312 | compiler->cb = _compileCbSingle; |
322 | compileScript(compiler, FALSE); | 313 | compileScript(compiler, FALSE); |
323 | } | 314 | } |