From ba57301e92831606a18289ec10c314edd756f311 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 14 Aug 2014 06:37:29 +1000 Subject: Considerable cleanup of the top level compiling code. --- src/LuaSL/LuaSL_LSL_tree.h | 13 +--- src/LuaSL/LuaSL_compile.c | 169 +++++++++++++++++++---------------------- src/LuaSL/LuaSL_lemon_yaccer.y | 6 +- src/LuaSL/LuaSL_main.c | 28 ++----- src/libraries/Runnr.c | 157 ++++++++++++-------------------------- src/libraries/Runnr.h | 2 +- 6 files changed, 144 insertions(+), 231 deletions(-) diff --git a/src/LuaSL/LuaSL_LSL_tree.h b/src/LuaSL/LuaSL_LSL_tree.h index 5b61926..b08d1db 100644 --- a/src/LuaSL/LuaSL_LSL_tree.h +++ b/src/LuaSL/LuaSL_LSL_tree.h @@ -5,7 +5,7 @@ #define LUASL_DEBUG 0 #define COMPILE_THREADED 0 #define LUASL_DIFF_CHECK 0 -#define LUASL_BAD_CHECK 0 +#define LUASL_BAD_CHECK 1 #include // So we can have NULL defined. @@ -300,7 +300,7 @@ struct _LSL_Script Eina_Hash *functions; Eina_Hash *states; Eina_Hash *variables; - int bugCount, warningCount; + int warningCount; }; /* Tracking variables. @@ -372,11 +372,8 @@ Need to do something about that. typedef struct { - LuaCompiler compiler; + LuaCompiler *compiler; void *scanner; // This should be of type yyscan_t, which is typedef to void * anyway, but that does not get defined until LuaSL_lexer.h, which depends on this struct being defined first. - int argc; - char **argv; - FILE *file; LSL_Leaf *ast; LSL_Script script; LSL_State state; @@ -390,8 +387,6 @@ typedef struct int column, line; int undeclared; boolean inState; - boolean doConstants; - boolean result; } LuaSL_compiler; @@ -402,7 +397,7 @@ typedef struct boolean compilerSetup(gameGlobals *ourGlobals); -boolean compileLSL(LuaSL_compiler *lCompiler); +void compileLSL(LuaCompiler *compiler); void burnLeaf(void *data); LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index 0b27cf5..d1ef48b 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c @@ -361,8 +361,8 @@ LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf } else { - compiler->script.bugCount++; - sendBack(compiler->compiler.client, compiler->compiler.SID, "compilerError(%d,%d,NOT FOUND variable %s)", identifier->line, identifier->column, identifier->value.stringValue); + compiler->compiler->bugCount++; + sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,NOT FOUND variable %s)", identifier->line, identifier->column, identifier->value.stringValue); } } @@ -404,7 +404,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, if (OT_undeclared == lType) { compiler->script.warningCount++; -// sendBack(compiler->compiler.client, compiler->compiler.SID, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column); +// sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column); lval->basicType = OT_undeclared; return lval; } @@ -432,7 +432,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, if (OT_undeclared == rType) { compiler->script.warningCount++; -// sendBack(compiler->compiler.client, compiler->compiler.SID, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column); +// sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column); lval->basicType = OT_undeclared; return lval; } @@ -632,8 +632,8 @@ else rightType = allowed[right->basicType].name; } - compiler->script.bugCount++; - sendBack(compiler->compiler.client, compiler->compiler.SID, "compilerError(%d,%d,Invalid operation [%s(%s) %s %s(%s)])", lval->line, lval->column, leftType, leftToken, lval->toKen->toKen, rightType, rightToken); + compiler->compiler->bugCount++; + sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,Invalid operation [%s(%s) %s %s(%s)])", lval->line, lval->column, leftType, leftToken, lval->toKen->toKen, rightType, rightToken); } } @@ -1152,7 +1152,7 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, } default : { - compiler->script.bugCount++; + compiler->compiler->bugCount++; PE("Should not be here %d.", stat->type); break; } @@ -2169,14 +2169,6 @@ static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content) fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already. } -static void _compileCb(LuaCompiler *compiler) -{ - free(compiler->luaName); - free(compiler->SID); - free(compiler->file); - free(compiler); -} - boolean compilerSetup(gameGlobals *ourGlobals) { int i; @@ -2191,7 +2183,7 @@ boolean compilerSetup(gameGlobals *ourGlobals) if (tokens) { char buf[PATH_MAX]; - LuaSL_compiler *compiler = calloc(1, sizeof(LuaSL_compiler)); + LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); // Sort the token table. for (i = 0; LSL_Tokens[i].toKen != NULL; i++) @@ -2205,13 +2197,11 @@ boolean compilerSetup(gameGlobals *ourGlobals) snprintf(buf, sizeof(buf), "luajit -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", prefix_lib_get()); system(buf); snprintf(buf, sizeof(buf), "%s/constants.lsl", prefix_lib_get()); - compiler->compiler.file = strdup(buf); - compiler->compiler.SID = strdup("FAKE_SID"); - compiler->compiler.data = ourGlobals; - compiler->compiler.cb = _compileCb; + compiler->file = strdup(buf); + compiler->SID = strdup("FAKE_SID"); compiler->doConstants = TRUE; - if (!compileLSL(compiler)) - _compileCb(&compiler->compiler); + compiler->parser = (compileCb) compileLSL; + compileScript(compiler, COMPILE_THREADED); return TRUE; } @@ -2221,77 +2211,85 @@ boolean compilerSetup(gameGlobals *ourGlobals) return FALSE; } -boolean compileLSL(LuaSL_compiler *compiler) +void compileLSL(LuaCompiler *compiler) { + LuaSL_compiler *lcompiler = calloc(1, sizeof(LuaSL_compiler)); void *pParser = ParseAlloc(malloc); #if LUASL_BAD_CHECK char tempName[PATH_MAX]; #endif + FILE *in; int yv; + lcompiler->compiler = compiler; + // Parse the LSL script, validating it and reporting errors. // Just pass all LSL constants and ll*() )function names through to Lua, assume they are globals there. - compiler->result = FALSE; - compiler->script.functions = eina_hash_stringshared_new(burnLeaf); - compiler->script.states = eina_hash_stringshared_new(burnLeaf); - compiler->script.variables = eina_hash_stringshared_new(burnLeaf); - eina_clist_init(&(compiler->danglingCalls)); + lcompiler->script.functions = eina_hash_stringshared_new(burnLeaf); + lcompiler->script.states = eina_hash_stringshared_new(burnLeaf); + lcompiler->script.variables = eina_hash_stringshared_new(burnLeaf); + eina_clist_init(&(lcompiler->danglingCalls)); #if LUASL_DIFF_CHECK - compiler->ignorable = eina_strbuf_new(); + lcompiler->ignorable = eina_strbuf_new(); #endif - PI("Compiling %s.", compiler->compiler.file); + PI("Compiling %s.", lcompiler->compiler->file); - compiler->file = fopen(compiler->compiler.file, "r"); - if (NULL == compiler->file) + in = fopen(lcompiler->compiler->file, "r"); + if (NULL == in) { - PE("Error opening file %s.", compiler->compiler.file); - return FALSE; + PE("Error opening file %s.", lcompiler->compiler->file); + return; } #if LUASL_BAD_CHECK // Mark the file as bad, in case we crash while compiling it. // NOTE - wont work so well when we are threaded. - sprintf(tempName, "%s.BAD", compiler->compiler.file); - ecore_file_mv(compiler->compiler.file, tempName); + sprintf(tempName, "%s.BAD", lcompiler->compiler->file); + ecore_file_mv(lcompiler->compiler->file, tempName); #endif - compiler->ast = NULL; - compiler->lval = newLeaf(LSL_UNKNOWN, NULL, NULL); + lcompiler->ast = NULL; + lcompiler->lval = newLeaf(LSL_UNKNOWN, NULL, NULL); // Text editors usually start counting at 1, even programmers editors. mcedit is an exception, but you can deal with that yourself. - compiler->column = 1; - compiler->line = 1; + lcompiler->column = 1; + lcompiler->line = 1; - if (yylex_init_extra(compiler, &(compiler->scanner))) - return compiler->result; + if (yylex_init_extra(lcompiler, &(lcompiler->scanner))) + return; if (LUASL_DEBUG) { - yyset_debug(1, compiler->scanner); + yyset_debug(1, lcompiler->scanner); ParseTrace(stdout, "LSL_lemon "); } - yyset_in(compiler->file, compiler->scanner); + yyset_in(in, lcompiler->scanner); // on EOF yylex will return 0 - while((yv = yylex(compiler->lval, compiler->scanner)) != 0) + while((yv = yylex(lcompiler->lval, lcompiler->scanner)) != 0) { - Parse(pParser, yv, compiler->lval, compiler); + Parse(pParser, yv, lcompiler->lval, lcompiler); if (LSL_SCRIPT == yv) break; - compiler->lval = newLeaf(LSL_UNKNOWN, NULL, NULL); + lcompiler->lval = newLeaf(LSL_UNKNOWN, NULL, NULL); } - yylex_destroy(compiler->scanner); - Parse(pParser, 0, compiler->lval, compiler); + yylex_destroy(lcompiler->scanner); + Parse(pParser, 0, lcompiler->lval, lcompiler); ParseFree(pParser, free); + if (NULL != in) + { + fclose(in); + in = NULL; + } - if (compiler->undeclared) + if (lcompiler->undeclared) { // PW("A second pass is needed to check if functions where used before they where declared. To avoid this second pass, don't do that."); - if (eina_clist_count(&(compiler->danglingCalls))) + if (eina_clist_count(&(lcompiler->danglingCalls))) { LSL_FunctionCall *call = NULL; - EINA_CLIST_FOR_EACH_ENTRY(call, &(compiler->danglingCalls), LSL_FunctionCall, dangler) + EINA_CLIST_FOR_EACH_ENTRY(call, &(lcompiler->danglingCalls), LSL_FunctionCall, dangler) { - LSL_Leaf *func = findFunction(compiler, call->call->value.stringValue); + LSL_Leaf *func = findFunction(lcompiler, call->call->value.stringValue); if (func) { @@ -2302,23 +2300,18 @@ boolean compileLSL(LuaSL_compiler *compiler) call->call->basicType = func->basicType; } else - sendBack(compiler->compiler.client, compiler->compiler.SID, "compilerError(%d,%d,NOT FOUND function %s called)", call->call->line, call->call->column, call->call->value.stringValue); + sendBack(lcompiler->compiler->client, lcompiler->compiler->SID, "compilerError(%d,%d,NOT FOUND function %s called)", call->call->line, call->call->column, call->call->value.stringValue); } } - secondPass(compiler, compiler->ast); + secondPass(lcompiler, lcompiler->ast); // PD("Second pass completed."); } - if (compiler->doConstants) - { - memcpy(&constants, &(compiler->script), sizeof(LSL_Script)); - compiler->result = TRUE; - } + if (lcompiler->compiler->doConstants) + memcpy(&constants, &(lcompiler->script), sizeof(LSL_Script)); else { - compiler->result = FALSE; - - if (compiler->ast) + if (lcompiler->ast) { FILE *out; char buffer[PATH_MAX]; @@ -2328,28 +2321,32 @@ boolean compileLSL(LuaSL_compiler *compiler) if (LUASL_DIFF_CHECK) { - strcpy(outName, compiler->compiler.file); + strcpy(outName, lcompiler->compiler->file); strcat(outName, "2"); out = fopen(outName, "w"); if (out) { char diffName[PATH_MAX]; - strcpy(diffName, compiler->compiler.file); + strcpy(diffName, lcompiler->compiler->file); strcat(diffName, ".diff"); - outputLeaf(out, OM_LSL, compiler->ast); + outputLeaf(out, OM_LSL, lcompiler->ast); fclose(out); - sprintf(buffer, "diff -u \"%s\" \"%s\" > \"%s\"", compiler->compiler.file, outName, diffName); + sprintf(buffer, "diff -u \"%s\" \"%s\" > \"%s\"", lcompiler->compiler->file, outName, diffName); count = system(buffer); if (0 != count) + { + lcompiler->compiler->bugCount++; PE("LSL output file is different - %s!", outName); - else - compiler->result = TRUE; + } } else + { + lcompiler->compiler->bugCount++; PC("Unable to open file %s for writing!", outName); + } } - strcpy(luaName, compiler->compiler.file); + strcpy(luaName, lcompiler->compiler->file); strcat(luaName, ".lua"); out = fopen(luaName, "w"); // Generate the Lua source code. @@ -2360,38 +2357,32 @@ boolean compileLSL(LuaSL_compiler *compiler) fprintf(out, "--// Generated code goes here.\n\n"); fprintf(out, "local _bit = require(\"bit\")\n"); fprintf(out, "local _LSL = require(\"LSL\")\n\n"); - fprintf(out, "local _SID = [=[%s]=]\n\n", compiler->compiler.SID); - strcpy(buffer, basename(compiler->compiler.file)); + fprintf(out, "local _SID = [=[%s]=]\n\n", lcompiler->compiler->SID); + strcpy(buffer, basename(lcompiler->compiler->file)); if ((ext = rindex(buffer, '.'))) ext[0] = '\0'; fprintf(out, "local _scriptName = [=[%s]=]\n\n", buffer); - outputLeaf(out, OM_LUA, compiler->ast); + outputLeaf(out, OM_LUA, lcompiler->ast); fprintf(out, "\n\n_LSL.mainLoop(_SID, _scriptName, _defaultState)\n"); // This actually starts the script running. fprintf(out, "\n--// End of generated code.\n\n"); fclose(out); - // Compile the Lua source code. - compiler->compiler.luaName = strdup(luaName); - compiler->compiler.bugCount = compiler->script.bugCount; - compileScript(&compiler->compiler, COMPILE_THREADED); - compiler->result = TRUE; + // Make sure the output gets compiled by Lua. + lcompiler->compiler->luaName = strdup(luaName); } else + { + lcompiler->compiler->bugCount++; PC("Unable to open file %s for writing!", luaName); + } } + burnLeaf(lcompiler->ast); } - if (NULL != compiler->file) - { - fclose(compiler->file); - compiler->file = NULL; - } - - if (!compiler->doConstants) - burnLeaf(compiler->ast); - #if LUASL_BAD_CHECK - ecore_file_mv(tempName, compiler->compiler.file); + ecore_file_mv(tempName, lcompiler->compiler->file); #endif - return compiler->result; + + free(lcompiler); + return; } diff --git a/src/LuaSL/LuaSL_lemon_yaccer.y b/src/LuaSL/LuaSL_lemon_yaccer.y index f03837e..2a23e84 100644 --- a/src/LuaSL/LuaSL_lemon_yaccer.y +++ b/src/LuaSL/LuaSL_lemon_yaccer.y @@ -229,19 +229,19 @@ expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; } %parse_failure { - compiler->script.bugCount++; + compiler->compiler->bugCount++; PE("Giving up. Parser is hopelessly lost!"); } %stack_overflow { - compiler->script.bugCount++; + compiler->compiler->bugCount++; PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. } %syntax_error { - compiler->script.bugCount++; + compiler->compiler->bugCount++; PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column); } diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 3ed9004..f316fdb 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c @@ -186,10 +186,6 @@ static void _compileCb(LuaCompiler *compiler) sendBack(compiler->client, compiler->SID, "compiled(true)"); else sendBack(compiler->client, compiler->SID, "compiled(false)"); - free(compiler->luaName); - free(compiler->SID); - free(compiler->file); - free(compiler); } static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) @@ -218,7 +214,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D { char *temp; char *file; - LuaSL_compiler *compiler = calloc(1, sizeof(LuaSL_compiler)); + LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); strcpy(buf, &command[8]); temp = buf; @@ -227,23 +223,13 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D temp++; temp[0] = '\0'; - compiler->compiler.file = strdup(file); - compiler->compiler.SID = strdup(SID); - compiler->compiler.client = ev->client; - compiler->compiler.data = ourGlobals; - compiler->compiler.cb = _compileCb; + compiler->file = strdup(file); + compiler->SID = strdup(SID); + compiler->client = ev->client; compiler->doConstants = FALSE; -#if COMPILE_THREADED - compiler->compiler.parser = (compileCb) compileLSL; - compileScript(&compiler->compiler); -#else - if (!compileLSL(compiler)) - { - compiler->compiler.bugCount++; - PE("Compile of %s failed in a mysterious way.", file); - _compileCb(&(compiler->compiler)); - } -#endif + compiler->parser = (compileCb) compileLSL; + compiler->cb = _compileCb; + compileScript(compiler, COMPILE_THREADED); } else if (0 == strncmp(command, "run(", 4)) { diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c index 760a860..1f10d33 100644 --- a/src/libraries/Runnr.c +++ b/src/libraries/Runnr.c @@ -410,85 +410,20 @@ static int luaWriter(lua_State *L, const void* p, size_t sz, void* ud) return result; } -// TODO - This didn't help the compile time much, perhaps move the rest of the compiling stage into this thread as a callback? -/* - -LuaSL.c : _data( ... "compile(" ... - allocate LuaSL_compiler - extract SID, file, and name from data stream - massage data into LuaCompiler - compileLSL(LuaCompiler, FALSE) -LuaSL_compile.c : compileLSL() - init it -* open the .LSL file -* init lexer -* run lexer in a loop -* setup second pass in a loop -* may do a sendBack() -* secondPass(LuaSL_compiler, ... ) -* open the .lua file -* generate Lua source code - compileScript(LuaSL_compiler) -Runnr;c : compileScript( - start a feedback thread - -LuaSL.c : _compileCb - scriptAdd( ... ) - Needs LuaCompiler-> file, SID, client, data - adds the compiled script to the list of scripts being run. - sendBack results - frees LuaCompiler-> luaName, SID, file. Alse frees LuaCompiler. - - -typedef void (* compileCb)(LuaCompile *compiler); - -typedef struct _LuaCompile -{ - char *file, *SID, *luaName; - int bugCount; - void *data; OurGlobals, Passed to the call back, to be passed to scriptAdd, which stores it as a void pointer, then ... ????? Don't think it's actually used. - Ecore_Con_Client *client; - compileCb parser; - compileCb cb; -} LuaCompiler; - -typedef struct -{ - LuaCompiler compiler; - void *scanner; // This should be of type yyscan_t, which is typedef to void * anyway, but that does not get defined until LuaSL_lexer.h, which depends on this struct being defined first. - int argc; - char **argv; - FILE *file; - LSL_Leaf *ast; - LSL_Script script; - LSL_State state; -#if LUASL_DIFF_CHECK - Eina_Strbuf *ignorable; -#endif - LSL_Leaf *lval; - LSL_Block *currentBlock; - LSL_Function *currentFunction; - Eina_Clist danglingCalls; // HEAD for function calls used before the function is defined. - int column, line; - int undeclared; - boolean inState; - boolean doConstants; - boolean result; -} LuaSL_compiler; - - -*/ - -static void _compileNotify(void *data, Ecore_Thread *thread, void *message) +// Gets called on the main thread when the compile thread ends or fails. +static void _compileEnd(void *data, Ecore_Thread *thread) { LuaCompiler *compiler = data; if (compiler->cb) compiler->cb(compiler); + free(compiler->file); + free(compiler->luaName); + free(compiler->SID); } // TODO - Should pass error messages back through a linked list. -// To eventually get passed back to the calling app via compiler->cb -// We use - luaName, bugCount, cb +// To eventually get passed back to the calling app via compiler->errors and compiler->warnings. +// Will need ageneric "add this formatted string to a linked list" function, in SledjHamr.c static void _compileThread(void *data, Ecore_Thread *thread) { LuaCompiler *compiler = data; @@ -499,62 +434,68 @@ static void _compileThread(void *data, Ecore_Thread *thread) if (compiler->parser) compiler->parser(compiler); - strcpy(name, compiler->luaName); - if ((L = luaL_newstate())) + if (compiler->luaName) { - luaL_openlibs(L); - // This ends up pushing a function onto the stack. The function is the compiled code. - err = luaL_loadfile(L, name); - if (err) + strcpy(name, compiler->luaName); + if ((L = luaL_newstate())) { - compiler->bugCount++; - if (LUA_ERRSYNTAX == err) - printf("Lua syntax error in %s: %s\n", name, lua_tostring(L, -1)); - else if (LUA_ERRFILE == err) - printf("Lua compile file error in %s: %s\n", name, lua_tostring(L, -1)); - else if (LUA_ERRMEM == err) - printf("Lua compile memory allocation error in %s: %s\n", name, lua_tostring(L, -1)); - } - else - { - // Write the compiled code to a file. - strcat(name, ".out"); - out = fopen(name, "w"); - if (out) + luaL_openlibs(L); + // This ends up pushing a function onto the stack. The function is the compiled code. + err = luaL_loadfile(L, name); + if (err) { - err = lua_dump(L, luaWriter, out); - if (err) - { - compiler->bugCount++; - printf("Lua compile file error writing to %s\n", name); - } - fclose(out); + compiler->bugCount++; + if (LUA_ERRSYNTAX == err) + printf("Lua syntax error in %s: %s\n", name, lua_tostring(L, -1)); + else if (LUA_ERRFILE == err) + printf("Lua compile file error in %s: %s\n", name, lua_tostring(L, -1)); + else if (LUA_ERRMEM == err) + printf("Lua compile memory allocation error in %s: %s\n", name, lua_tostring(L, -1)); } else { - compiler->bugCount++; - printf("CRITICAL! Unable to open file %s for writing!\n", name); + // Write the compiled code to a file. + strcat(name, ".out"); + out = fopen(name, "w"); + if (out) + { + err = lua_dump(L, luaWriter, out); + if (err) + { + compiler->bugCount++; + printf("Lua compile file error writing to %s\n", name); + } + fclose(out); + } + else + { + compiler->bugCount++; + printf("CRITICAL! Unable to open file %s for writing!\n", name); + } } } + else if (!compiler->doConstants) + { + compiler->bugCount++; + printf("Can't create a new Lua state!\n"); + } } else { compiler->bugCount++; - printf("Can't create a new Lua state!\n"); + printf("Nothing for Lua to compile!\n"); } - - if (thread) - ecore_thread_feedback(thread, compiler); - else - _compileNotify(compiler, thread, NULL); } void compileScript(LuaCompiler *compiler, int threadIt) { if (threadIt) - ecore_thread_feedback_run(_compileThread, _compileNotify, NULL, NULL, compiler, EINA_FALSE); + ecore_thread_run(_compileThread, _compileEnd, _compileEnd, compiler); else + { _compileThread(compiler, NULL); + _compileEnd(compiler, NULL); + } } // Assumes the scripts mutex is taken already. diff --git a/src/libraries/Runnr.h b/src/libraries/Runnr.h index 8837eed..63e0afc 100644 --- a/src/libraries/Runnr.h +++ b/src/libraries/Runnr.h @@ -34,10 +34,10 @@ typedef struct _LuaCompile { char *file, *SID, *luaName; int bugCount; - void *data; Ecore_Con_Client *client; compileCb parser; compileCb cb; + boolean doConstants; } LuaCompiler; typedef struct _script script; -- cgit v1.1