diff options
Diffstat (limited to '')
-rw-r--r-- | src/LuaSL/LuaSL_compile.c | 32 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_main.c | 14 |
2 files changed, 40 insertions, 6 deletions
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index d1ef48b..b2ae841 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c | |||
@@ -223,6 +223,15 @@ LSL_Script constants; | |||
223 | int lowestToken = 999999; | 223 | int lowestToken = 999999; |
224 | 224 | ||
225 | 225 | ||
226 | static void finishMessage(LuaCompile *compiler, compileMessage *message, int type, int column, int line) | ||
227 | { | ||
228 | message->type = type; | ||
229 | message->column = column; | ||
230 | message->line = line; | ||
231 | if (type) | ||
232 | compiler->bugCount++; | ||
233 | } | ||
234 | |||
226 | static LSL_Leaf *newLeaf(LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) | 235 | static LSL_Leaf *newLeaf(LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) |
227 | { | 236 | { |
228 | LSL_Leaf *leaf = calloc(1, sizeof(LSL_Leaf)); | 237 | LSL_Leaf *leaf = calloc(1, sizeof(LSL_Leaf)); |
@@ -361,8 +370,11 @@ LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf | |||
361 | } | 370 | } |
362 | else | 371 | else |
363 | { | 372 | { |
364 | compiler->compiler->bugCount++; | 373 | // compiler->compiler->bugCount++; |
365 | sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,NOT FOUND variable %s)", identifier->line, identifier->column, identifier->value.stringValue); | 374 | // sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,NOT FOUND variable %s)", identifier->line, identifier->column, identifier->value.stringValue); |
375 | finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage), | ||
376 | "NOT FOUND variable %s", identifier->value.stringValue), | ||
377 | 1, identifier->column, identifier->line); | ||
366 | } | 378 | } |
367 | } | 379 | } |
368 | 380 | ||
@@ -632,8 +644,11 @@ else | |||
632 | rightType = allowed[right->basicType].name; | 644 | rightType = allowed[right->basicType].name; |
633 | } | 645 | } |
634 | 646 | ||
635 | compiler->compiler->bugCount++; | 647 | // compiler->compiler->bugCount++; |
636 | 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); | 648 | // 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); |
649 | finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage), | ||
650 | "Invalid operation [%s(%s) %s %s(%s)]", leftType, leftToken, lval->toKen->toKen, rightType, rightToken), | ||
651 | 1, lval->column, lval->line); | ||
637 | } | 652 | } |
638 | } | 653 | } |
639 | 654 | ||
@@ -2234,7 +2249,7 @@ void compileLSL(LuaCompiler *compiler) | |||
2234 | lcompiler->ignorable = eina_strbuf_new(); | 2249 | lcompiler->ignorable = eina_strbuf_new(); |
2235 | #endif | 2250 | #endif |
2236 | 2251 | ||
2237 | PI("Compiling %s.", lcompiler->compiler->file); | 2252 | // PI("Compiling %s.", lcompiler->compiler->file); |
2238 | 2253 | ||
2239 | in = fopen(lcompiler->compiler->file, "r"); | 2254 | in = fopen(lcompiler->compiler->file, "r"); |
2240 | if (NULL == in) | 2255 | if (NULL == in) |
@@ -2300,7 +2315,12 @@ void compileLSL(LuaCompiler *compiler) | |||
2300 | call->call->basicType = func->basicType; | 2315 | call->call->basicType = func->basicType; |
2301 | } | 2316 | } |
2302 | else | 2317 | else |
2303 | 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); | 2318 | { |
2319 | // 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); | ||
2320 | finishMessage(lcompiler->compiler, addMessage(&(lcompiler->compiler->messages), sizeof(compileMessage), | ||
2321 | "NOT FOUND function %s called)", call->call->value.stringValue), | ||
2322 | 1, call->call->column, call->call->line); | ||
2323 | } | ||
2304 | } | 2324 | } |
2305 | } | 2325 | } |
2306 | secondPass(lcompiler, lcompiler->ast); | 2326 | secondPass(lcompiler, lcompiler->ast); |
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index f316fdb..1eaa43a 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c | |||
@@ -182,6 +182,18 @@ static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Ad | |||
182 | 182 | ||
183 | static void _compileCb(LuaCompiler *compiler) | 183 | static void _compileCb(LuaCompiler *compiler) |
184 | { | 184 | { |
185 | compileMessage *message = NULL, *safe = NULL; | ||
186 | |||
187 | EINA_CLIST_FOR_EACH_ENTRY_SAFE(message, safe, &(compiler->messages), compileMessage, node) | ||
188 | { | ||
189 | if (message->type) | ||
190 | sendBack(compiler->client, compiler->SID, "compilerError(%d,%d,%s)", message->line, message->column, message->message); | ||
191 | else | ||
192 | sendBack(compiler->client, compiler->SID, "compilerWarning(%d,%d,%s)", message->line, message->column, message->message); | ||
193 | eina_clist_remove(&(message->node)); | ||
194 | free(message); | ||
195 | } | ||
196 | |||
185 | if (0 == compiler->bugCount) | 197 | if (0 == compiler->bugCount) |
186 | sendBack(compiler->client, compiler->SID, "compiled(true)"); | 198 | sendBack(compiler->client, compiler->SID, "compiled(true)"); |
187 | else | 199 | else |
@@ -223,6 +235,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D | |||
223 | temp++; | 235 | temp++; |
224 | temp[0] = '\0'; | 236 | temp[0] = '\0'; |
225 | 237 | ||
238 | eina_clist_init(&(compiler->messages)); | ||
226 | compiler->file = strdup(file); | 239 | compiler->file = strdup(file); |
227 | compiler->SID = strdup(SID); | 240 | compiler->SID = strdup(SID); |
228 | compiler->client = ev->client; | 241 | compiler->client = ev->client; |
@@ -304,6 +317,7 @@ int main(int argc, char **argv) | |||
304 | ourGlobals.names = eina_hash_string_superfast_new(NULL); | 317 | ourGlobals.names = eina_hash_string_superfast_new(NULL); |
305 | if (ecore_init()) | 318 | if (ecore_init()) |
306 | { | 319 | { |
320 | // ecore_thread_max_set(4); | ||
307 | if (ecore_con_init()) | 321 | if (ecore_con_init()) |
308 | { | 322 | { |
309 | if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals))) | 323 | if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals))) |