From b4dae31e4a688dea7779b83451b8179437b9c0c3 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 9 Aug 2014 20:09:28 +1000 Subject: Major cleanup of compileLSL() and friends, including threading it. --- src/LuaSL/LuaSL_main.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/LuaSL/LuaSL_main.c') diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 41576c2..0378792 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c @@ -226,7 +226,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D char *temp; char *file; char *name; - LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); + LuaSL_compiler *compiler = calloc(1, sizeof(LuaSL_compiler)); strcpy(buf, &command[8]); temp = buf; @@ -237,17 +237,23 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D name = &file[strlen(prefix_data_get())]; PD("Compiling %s, %s.", SID, name); - compiler->file = strdup(file); - compiler->SID = strdup(SID); - compiler->client = ev->client; - compiler->data = ourGlobals; - compiler->cb = _compileCb; - if (!compileLSL(compiler, ourGlobals, ev->client, SID, file, FALSE)) + compiler->compiler.file = strdup(file); + compiler->compiler.SID = strdup(SID); + compiler->compiler.client = ev->client; + compiler->compiler.data = ourGlobals; + compiler->compiler.cb = _compileCb; + compiler->doConstants = FALSE; +#if COMPILE_THREADED + compiler->compiler.parser = (compileCb) compileLSL; + compileScript(&compiler->compiler); +#else + if (!compileLSL(compiler)) { - compiler->bugCount++; + compiler->compiler.bugCount++; PE("Compile of %s failed in a mysterious way.", file); - _compileCb(compiler); + _compileCb(&(compiler->compiler)); } +#endif } else if (0 == strcmp(command, "run()")) { -- cgit v1.1