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.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 2a4c503..afff67f 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -316,7 +316,7 @@ static LSL_Leaf *findVariable(LuaSL_compiler *compiler, const char *name)
316 316
317LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *dot, LSL_Leaf *sub) 317LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *dot, LSL_Leaf *sub)
318{ 318{
319 gameGlobals *game = compiler->game; 319 gameGlobals *ourGlobals = compiler->game;
320 const char *search; 320 const char *search;
321 321
322 if (dot) 322 if (dot)
@@ -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 sendBack(game, compiler->client, compiler->SID, "compilerError(%d,%d,NOT found %s)", identifier->line, identifier->column, identifier->value.stringValue); 361 sendBack(ourGlobals, compiler->client, compiler->SID, "compilerError(%d,%d,NOT found %s)", identifier->line, identifier->column, identifier->value.stringValue);
362 } 362 }
363 } 363 }
364 364
@@ -367,7 +367,7 @@ LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf
367 367
368LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) 368LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right)
369{ 369{
370 gameGlobals *game = compiler->game; 370 gameGlobals *ourGlobals = compiler->game;
371 371
372 if (lval) 372 if (lval)
373 { 373 {
@@ -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 sendBack(game, compiler->client, compiler->SID, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column); 405 sendBack(ourGlobals, compiler->client, compiler->SID, "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 sendBack(game, compiler->client, compiler->SID, "compilerWarning(%d,%d,Undeclared identifier issue, deferring this until the second pass)", lval->line, lval->column); 433 sendBack(ourGlobals, compiler->client, compiler->SID, "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 sendBack(game, compiler->client, compiler->SID, "compilerError(%d,%d,Invalid operation [%s(%s) %s %s(%s)])", lval->line, lval->column, leftType, leftToken, lval->toKen->toKen, rightType, rightToken); 590 sendBack(ourGlobals, compiler->client, compiler->SID, "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
@@ -991,7 +991,7 @@ LSL_Leaf *addFor(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_L
991 991
992LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block, LSL_Leaf *identifier) 992LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block, LSL_Leaf *identifier)
993{ 993{
994 gameGlobals *game = compiler->game; 994 gameGlobals *ourGlobals = compiler->game;
995 LSL_Statement *stat = calloc(1, sizeof(LSL_Statement)); 995 LSL_Statement *stat = calloc(1, sizeof(LSL_Statement));
996 boolean justOne = FALSE; 996 boolean justOne = FALSE;
997 997
@@ -2095,7 +2095,7 @@ static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content)
2095 fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already. 2095 fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already.
2096} 2096}
2097 2097
2098boolean compilerSetup(gameGlobals *game) 2098boolean compilerSetup(gameGlobals *ourGlobals)
2099{ 2099{
2100 int i; 2100 int i;
2101 2101
@@ -2122,7 +2122,7 @@ boolean compilerSetup(gameGlobals *game)
2122 snprintf(buf, sizeof(buf), "lua -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", PACKAGE_DATA_DIR); 2122 snprintf(buf, sizeof(buf), "lua -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", PACKAGE_DATA_DIR);
2123 system(buf); 2123 system(buf);
2124 snprintf(buf, sizeof(buf), "%s/constants.lsl", PACKAGE_DATA_DIR); 2124 snprintf(buf, sizeof(buf), "%s/constants.lsl", PACKAGE_DATA_DIR);
2125 compileLSL(game, NULL, "FAKE_SID", buf, TRUE); 2125 compileLSL(ourGlobals, NULL, "FAKE_SID", buf, TRUE);
2126 2126
2127 return TRUE; 2127 return TRUE;
2128 } 2128 }
@@ -2142,7 +2142,7 @@ static int luaWriter(lua_State *L, const void* p, size_t sz, void* ud)
2142 return result; 2142 return result;
2143} 2143}
2144 2144
2145boolean compileLSL(gameGlobals *game, Ecore_Con_Client *client, char *SID, char *script, boolean doConstants) 2145boolean compileLSL(gameGlobals *ourGlobals, Ecore_Con_Client *client, char *SID, char *script, boolean doConstants)
2146{ 2146{
2147 boolean result = FALSE; 2147 boolean result = FALSE;
2148 LuaSL_compiler compiler; 2148 LuaSL_compiler compiler;
@@ -2153,7 +2153,7 @@ boolean compileLSL(gameGlobals *game, Ecore_Con_Client *client, char *SID, char
2153// Just pass all LSL constants and ll*() )function names through to Lua, assume they are globals there. 2153// Just pass all LSL constants and ll*() )function names through to Lua, assume they are globals there.
2154 2154
2155 memset(&compiler, 0, sizeof(LuaSL_compiler)); 2155 memset(&compiler, 0, sizeof(LuaSL_compiler));
2156 compiler.game = game; 2156 compiler.game = ourGlobals;
2157 compiler.client = client; 2157 compiler.client = client;
2158 compiler.script.functions = eina_hash_stringshared_new(burnLeaf); 2158 compiler.script.functions = eina_hash_stringshared_new(burnLeaf);
2159 compiler.script.states = eina_hash_stringshared_new(burnLeaf); 2159 compiler.script.states = eina_hash_stringshared_new(burnLeaf);
@@ -2220,7 +2220,7 @@ boolean compileLSL(gameGlobals *game, Ecore_Con_Client *client, char *SID, char
2220 call->call->basicType = func->basicType; 2220 call->call->basicType = func->basicType;
2221 } 2221 }
2222 else 2222 else
2223 sendBack(game, compiler.client, compiler.SID, "compilerError(%d,%d,Undeclared function %s called)", call->call->line, call->call->column, call->call->value.stringValue); 2223 sendBack(ourGlobals, compiler.client, compiler.SID, "compilerError(%d,%d,Undeclared function %s called)", call->call->line, call->call->column, call->call->value.stringValue);
2224 } 2224 }
2225 } 2225 }
2226 secondPass(&compiler, compiler.ast); 2226 secondPass(&compiler, compiler.ast);