aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'LuaSL/src/LuaSL_compile.c')
-rw-r--r--LuaSL/src/LuaSL_compile.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 95761a2..8e9bd01 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -358,7 +358,7 @@ LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf
358 else 358 else
359 { 359 {
360 compiler->script.bugCount++; 360 compiler->script.bugCount++;
361 PE("NOT found %s @ line %d, column %d!", identifier->value.stringValue, identifier->line, identifier->column); 361 sendBack(game, compiler->client, compiler->fileName, "compilerError(%d,%d,NOT found %s)", identifier->line, identifier->column, identifier->value.stringValue);
362 } 362 }
363 } 363 }
364 364
@@ -402,7 +402,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
402 if (OT_undeclared == lType) 402 if (OT_undeclared == lType)
403 { 403 {
404 compiler->script.warningCount++; 404 compiler->script.warningCount++;
405 PW("Undeclared identifier issue, deferring this until the second pass. @ line %d, column %d.", lval->line, lval->column); 405 sendBack(game, compiler->client, compiler->fileName, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column);
406 lval->basicType = OT_undeclared; 406 lval->basicType = OT_undeclared;
407 return lval; 407 return lval;
408 } 408 }
@@ -430,7 +430,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
430 if (OT_undeclared == rType) 430 if (OT_undeclared == rType)
431 { 431 {
432 compiler->script.warningCount++; 432 compiler->script.warningCount++;
433 PW("Undeclared identifier issue, deferring this until the second pass. @ line %d, column %d.", lval->line, lval->column); 433 sendBack(game, compiler->client, compiler->fileName, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column);
434 lval->basicType = OT_undeclared; 434 lval->basicType = OT_undeclared;
435 return lval; 435 return lval;
436 } 436 }
@@ -587,7 +587,7 @@ else
587 } 587 }
588 588
589 compiler->script.bugCount++; 589 compiler->script.bugCount++;
590 PE("Invalid operation [%s(%s) %s %s(%s)] @ line %d, column %d!", leftType, leftToken, lval->toKen->toKen, rightType, rightToken, lval->line, lval->column); 590 sendBack(game, compiler->client, compiler->fileName, "compilerError(%d,%d,Invalid operation [%s(%s) %s %s(%s)])", lval->line, lval->column, leftType, leftToken, lval->toKen->toKen, rightType, rightToken);
591 } 591 }
592 } 592 }
593 593
@@ -2120,7 +2120,7 @@ boolean compilerSetup(gameGlobals *game)
2120 2120
2121 // Compile the constants. 2121 // Compile the constants.
2122 snprintf(buf, sizeof(buf), "%s/src/constants.lsl", PACKAGE_DATA_DIR); 2122 snprintf(buf, sizeof(buf), "%s/src/constants.lsl", PACKAGE_DATA_DIR);
2123 compileLSL(game, buf, TRUE); 2123 compileLSL(game, NULL, buf, TRUE);
2124 2124
2125 return TRUE; 2125 return TRUE;
2126 } 2126 }
@@ -2140,7 +2140,7 @@ static int luaWriter(lua_State *L, const void* p, size_t sz, void* ud)
2140 return result; 2140 return result;
2141} 2141}
2142 2142
2143boolean compileLSL(gameGlobals *game, char *script, boolean doConstants) 2143boolean compileLSL(gameGlobals *game, Ecore_Con_Client *client, char *script, boolean doConstants)
2144{ 2144{
2145 boolean result = FALSE; 2145 boolean result = FALSE;
2146 LuaSL_compiler compiler; 2146 LuaSL_compiler compiler;
@@ -2152,6 +2152,7 @@ boolean compileLSL(gameGlobals *game, char *script, boolean doConstants)
2152 2152
2153 memset(&compiler, 0, sizeof(LuaSL_compiler)); 2153 memset(&compiler, 0, sizeof(LuaSL_compiler));
2154 compiler.game = game; 2154 compiler.game = game;
2155 compiler.client = client;
2155 compiler.script.functions = eina_hash_stringshared_new(burnLeaf); 2156 compiler.script.functions = eina_hash_stringshared_new(burnLeaf);
2156 compiler.script.states = eina_hash_stringshared_new(burnLeaf); 2157 compiler.script.states = eina_hash_stringshared_new(burnLeaf);
2157 compiler.script.variables = eina_hash_stringshared_new(burnLeaf); 2158 compiler.script.variables = eina_hash_stringshared_new(burnLeaf);
@@ -2215,7 +2216,7 @@ boolean compileLSL(gameGlobals *game, char *script, boolean doConstants)
2215 call->call->basicType = func->basicType; 2216 call->call->basicType = func->basicType;
2216 } 2217 }
2217 else 2218 else
2218 PE("Undeclared function %s called @ line %d, column %d!", call->call->value.stringValue, call->call->line, call->call->column); 2219 sendBack(game, compiler.client, compiler.fileName, "compilerError(%d,%d,Undeclared function %s called)", call->call->line, call->call->column, call->call->value.stringValue);
2219 } 2220 }
2220 } 2221 }
2221 secondPass(&compiler, compiler.ast); 2222 secondPass(&compiler, compiler.ast);
@@ -2319,16 +2320,8 @@ boolean compileLSL(gameGlobals *game, char *script, boolean doConstants)
2319 PC("Unable to open file %s for writing!", luaName); 2320 PC("Unable to open file %s for writing!", luaName);
2320 } 2321 }
2321 2322
2322 if (compiler.script.bugCount) 2323 if (0 == compiler.script.bugCount)
2323 PE("%d errors and %d warnings in %s", compiler.script.bugCount, compiler.script.warningCount, compiler.fileName);
2324 else
2325 {
2326 if (compiler.script.warningCount)
2327 PW("%d errors and %d warnings in %s", compiler.script.bugCount, compiler.script.warningCount, compiler.fileName);
2328// else
2329// PI("%d errors and %d warnings in %s", compiler.script.bugCount, compiler.script.warningCount, compiler.fileName);
2330 result = TRUE; 2324 result = TRUE;
2331 }
2332 } 2325 }
2333 2326
2334 if (NULL != compiler.file) 2327 if (NULL != compiler.file)