aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/LuaSL
diff options
context:
space:
mode:
Diffstat (limited to 'src/LuaSL')
-rw-r--r--src/LuaSL/LuaSL_LSL_tree.h4
-rw-r--r--src/LuaSL/LuaSL_compile.c17
-rw-r--r--src/LuaSL/LuaSL_main.c23
3 files changed, 10 insertions, 34 deletions
diff --git a/src/LuaSL/LuaSL_LSL_tree.h b/src/LuaSL/LuaSL_LSL_tree.h
index e7c5e36..514443a 100644
--- a/src/LuaSL/LuaSL_LSL_tree.h
+++ b/src/LuaSL/LuaSL_LSL_tree.h
@@ -3,8 +3,6 @@
3#define __LUASL_TREE_H__ 3#define __LUASL_TREE_H__
4 4
5#define LUASL_DEBUG 0 5#define LUASL_DEBUG 0
6#define COMPILE_THREADED 1
7#define COMPILE_OUTPUT 0
8#define LUASL_DIFF_CHECK 0 6#define LUASL_DIFF_CHECK 0
9#define LUASL_BAD_CHECK 0 7#define LUASL_BAD_CHECK 0
10 8
@@ -408,8 +406,6 @@ typedef struct
408#endif 406#endif
409 407
410 408
411void finishMessage(LuaCompile *compiler, compileMessage *message, int type, int column, int line);
412
413boolean compilerSetup(gameGlobals *ourGlobals); 409boolean compilerSetup(gameGlobals *ourGlobals);
414void compileLSL(LuaCompiler *compiler); 410void compileLSL(LuaCompiler *compiler);
415void burnLeaf(void *data); 411void burnLeaf(void *data);
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c
index 13ebe1e..2b838e3 100644
--- a/src/LuaSL/LuaSL_compile.c
+++ b/src/LuaSL/LuaSL_compile.c
@@ -220,15 +220,6 @@ LSL_Script constants;
220int lowestToken = 999999; 220int lowestToken = 999999;
221 221
222 222
223void finishMessage(LuaCompile *compiler, compileMessage *message, int type, int column, int line)
224{
225 message->type = type;
226 message->column = column;
227 message->line = line;
228 if (type)
229 compiler->bugCount++;
230}
231
232static LSL_Leaf *newLeaf(LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) 223static LSL_Leaf *newLeaf(LSL_Type type, LSL_Leaf *left, LSL_Leaf *right)
233{ 224{
234 LSL_Leaf *leaf = calloc(1, sizeof(LSL_Leaf)); 225 LSL_Leaf *leaf = calloc(1, sizeof(LSL_Leaf));
@@ -596,7 +587,7 @@ else if (right)
596 printf("NOLEFT %s %s\n", lval->toKen->toKen, right->toKen->toKen); 587 printf("NOLEFT %s %s\n", lval->toKen->toKen, right->toKen->toKen);
597else 588else
598 printf("NOLEFT %s NORIGHT\n", lval->toKen->toKen); 589 printf("NOLEFT %s NORIGHT\n", lval->toKen->toKen);
599 printf("############################################################################## left\n"); 590 printf("############################################################################## left - column %i, line %i %s\n", lval->column, lval->line, compiler->compiler->file);
600#endif 591#endif
601 left->flags |= MF_WRAPFUNC; 592 left->flags |= MF_WRAPFUNC;
602 if (LSL_PARENTHESIS_OPEN == left->toKen->type) 593 if (LSL_PARENTHESIS_OPEN == left->toKen->type)
@@ -2222,7 +2213,7 @@ boolean compilerSetup(gameGlobals *ourGlobals)
2222 if (tokens) 2213 if (tokens)
2223 { 2214 {
2224 char buf[PATH_MAX]; 2215 char buf[PATH_MAX];
2225 LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); 2216 LuaCompiler *compiler;
2226 2217
2227 // Sort the token table. 2218 // Sort the token table.
2228 for (i = 0; LSL_Tokens[i].toKen != NULL; i++) 2219 for (i = 0; LSL_Tokens[i].toKen != NULL; i++)
@@ -2236,10 +2227,8 @@ boolean compilerSetup(gameGlobals *ourGlobals)
2236 snprintf(buf, sizeof(buf), "luajit -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", prefix_lib_get()); 2227 snprintf(buf, sizeof(buf), "luajit -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", prefix_lib_get());
2237 system(buf); 2228 system(buf);
2238 snprintf(buf, sizeof(buf), "%s/constants.lsl", prefix_lib_get()); 2229 snprintf(buf, sizeof(buf), "%s/constants.lsl", prefix_lib_get());
2239 compiler->file = strdup(buf); 2230 compiler = createCompiler("FAKE_SID", buf, (compileCb) compileLSL, NULL);
2240 compiler->SID = strdup("FAKE_SID");
2241 compiler->doConstants = TRUE; 2231 compiler->doConstants = TRUE;
2242 compiler->parser = (compileCb) compileLSL;
2243 compileScript(compiler, FALSE); 2232 compileScript(compiler, FALSE);
2244 2233
2245 return TRUE; 2234 return TRUE;
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index 664cdd1..b72a155 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -228,7 +228,7 @@ static Eina_Bool parser(void *data, Connection *connection, char *SID, char *com
228 { 228 {
229 char *temp; 229 char *temp;
230 char *file; 230 char *file;
231 LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); 231 LuaCompiler *compiler;
232 232
233 strcpy(buf, &command[8]); 233 strcpy(buf, &command[8]);
234 temp = buf; 234 temp = buf;
@@ -237,15 +237,10 @@ static Eina_Bool parser(void *data, Connection *connection, char *SID, char *com
237 temp++; 237 temp++;
238 temp[0] = '\0'; 238 temp[0] = '\0';
239 239
240 eina_clist_init(&(compiler->messages)); 240 compiler = createCompiler(SID, file, (compileCb) compileLSL, _compileCb);
241 compiler->file = strdup(file);
242 compiler->SID = strdup(SID);
243 compiler->client = connection; 241 compiler->client = connection;
244 compiler->doConstants = FALSE; 242 PI("Compiling script %s", file);
245 compiler->parser = (compileCb) compileLSL; 243 compileScript(compiler, TRUE);
246 compiler->cb = _compileCb;
247PD("Compiling script %s", file);
248 compileScript(compiler, COMPILE_THREADED);
249 } 244 }
250 else if (0 == strncmp(command, "run(", 4)) 245 else if (0 == strncmp(command, "run(", 4))
251 { 246 {
@@ -266,7 +261,7 @@ PD("Compiling script %s", file);
266 me = getScript(SID); 261 me = getScript(SID);
267 if (me) 262 if (me)
268 { 263 {
269PD("Running script %s", me->fileName); 264 PI("Running script %s", me->fileName);
270 runScript(me); 265 runScript(me);
271 releaseScript(me); 266 releaseScript(me);
272 } 267 }
@@ -311,13 +306,9 @@ int main(int argc, char **argv)
311 // get the arguments passed in 306 // get the arguments passed in
312 while (--argc > 0 && *++argv != '\0') 307 while (--argc > 0 && *++argv != '\0')
313 { 308 {
314 LuaCompiler *compiler = calloc(1, sizeof(LuaCompiler)); 309 LuaCompiler *compiler;
315 310
316 eina_clist_init(&(compiler->messages)); 311 compiler = createCompiler("0", *argv, (compileCb) compileLSL, _compileCbSingle);
317 compiler->file = strdup(*argv);
318 compiler->SID = strdup("0");
319 compiler->doConstants = FALSE;
320 compiler->parser = (compileCb) compileLSL;
321 compiler->cb = _compileCbSingle; 312 compiler->cb = _compileCbSingle;
322 compileScript(compiler, FALSE); 313 compileScript(compiler, FALSE);
323 } 314 }