aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-12 00:22:36 +1000
committerDavid Walter Seikel2012-02-12 00:22:36 +1000
commita0263e9618f37101d4beb182853b653fe4727667 (patch)
treefe97898fe4aad8d4c3fe35001c434e6f9b36cc3c /LuaSL/src
parentMissed this in the SID change commit. (diff)
downloadSledjHamr-a0263e9618f37101d4beb182853b653fe4727667.zip
SledjHamr-a0263e9618f37101d4beb182853b653fe4727667.tar.gz
SledjHamr-a0263e9618f37101d4beb182853b653fe4727667.tar.bz2
SledjHamr-a0263e9618f37101d4beb182853b653fe4727667.tar.xz
Little clean ups.
Diffstat (limited to 'LuaSL/src')
-rw-r--r--LuaSL/src/LSL.lua11
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h7
-rw-r--r--LuaSL/src/LuaSL_main.c2
-rw-r--r--LuaSL/src/LuaSL_test.c6
4 files changed, 12 insertions, 14 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua
index 7a47a69..56cd3ae 100644
--- a/LuaSL/src/LSL.lua
+++ b/LuaSL/src/LSL.lua
@@ -537,7 +537,7 @@ local running = true
537local paused = false 537local paused = false
538 538
539-- Stuff called from the wire protocol has to be global, but I think this means just global to this file. 539-- Stuff called from the wire protocol has to be global, but I think this means just global to this file.
540function pause() paused = true end 540function stop() paused = true end
541function quit() running = false end 541function quit() running = false end
542 542
543function LSL.stateChange(x) 543function LSL.stateChange(x)
@@ -580,15 +580,16 @@ function LSL.mainLoop(sid, x)
580 580
581 LSL.stateChange(x); 581 LSL.stateChange(x);
582 582
583 -- TODO - Need a FIFO queue of incoming events. Which will be in the C main thread, coz that's listening on the socket for us. 583 -- Need a FIFO queue of incoming events. Which will be in the C main thread, coz that's listening on the socket for us.
584 -- Actually, I think the luaproc message system manages such a queue for us anyway. 584 -- The ecore_con stuff ends up being a sorta FIFO queue of the commands coming from OpenSim.
585 -- C should strip off the "SID." part and replace it with "_LSL.", so might be better to restrict the wire protocol to single function calls. 585 -- Plus, I think the luaproc message system manages a FIFO queue for us as well.
586 -- Might still need one. lol
586 587
587 while running do 588 while running do
588 local message = luaproc.receive(sid) 589 local message = luaproc.receive(sid)
589 if message then 590 if message then
590 if paused then 591 if paused then
591 if "resume()" == message then paused = false end 592 if "start()" == message then paused = false end
592 else 593 else
593 result, errorMsg = loadstring(message) -- "The environment of the returned function is the global environment." Though normally, a function inherits it's environment from the function creating it. Which is what we want. lol 594 result, errorMsg = loadstring(message) -- "The environment of the returned function is the global environment." Though normally, a function inherits it's environment from the function creating it. Which is what we want. lol
594 if nil == result then 595 if nil == result then
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 4d50242..286d22d 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -413,7 +413,11 @@ typedef struct
413#endif 413#endif
414 414
415 415
416
417boolean compilerSetup(gameGlobals *game);
418boolean compileLSL(gameGlobals *game, char *script, boolean doConstants);
416void burnLeaf(void *data); 419void burnLeaf(void *data);
420
417LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); 421LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right);
418LSL_Leaf *addCrement(LuaSL_compiler *compiler, LSL_Leaf *variable, LSL_Leaf *crement, LSL_Type type); 422LSL_Leaf *addCrement(LuaSL_compiler *compiler, LSL_Leaf *variable, LSL_Leaf *crement, LSL_Type type);
419LSL_Leaf *addFor(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr0, LSL_Leaf *stat0, LSL_Leaf *expr1, LSL_Leaf *stat1, LSL_Leaf *expr2, LSL_Leaf *right, LSL_Leaf *block); 423LSL_Leaf *addFor(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr0, LSL_Leaf *stat0, LSL_Leaf *expr1, LSL_Leaf *stat1, LSL_Leaf *expr2, LSL_Leaf *right, LSL_Leaf *block);
@@ -438,9 +442,6 @@ LSL_Leaf *collectArguments(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *c
438LSL_Leaf *collectParameters(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); 442LSL_Leaf *collectParameters(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam);
439LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *newStatement); 443LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *newStatement);
440 444
441boolean compilerSetup(gameGlobals *game);
442boolean compileLSL(gameGlobals *game, char *script, boolean doConstants);
443
444void *ParseAlloc(void *(*mallocProc)(size_t)); 445void *ParseAlloc(void *(*mallocProc)(size_t));
445void ParseTrace(FILE *TraceFILE, char *zTracePrompt); 446void ParseTrace(FILE *TraceFILE, char *zTracePrompt);
446void Parse(void *yyp, int yymajor, LSL_Leaf *yyminor, LuaSL_compiler *compiler); 447void Parse(void *yyp, int yymajor, LSL_Leaf *yyminor, LuaSL_compiler *compiler);
diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c
index 6daa97d..7dad1c0 100644
--- a/LuaSL/src/LuaSL_main.c
+++ b/LuaSL/src/LuaSL_main.c
@@ -41,7 +41,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D
41 else 41 else
42 sendBack(game, ev->client, SID, "compiled(false)"); 42 sendBack(game, ev->client, SID, "compiled(false)");
43 } 43 }
44 else if (0 == strcmp(command, "start()")) 44 else if (0 == strcmp(command, "run()"))
45 { 45 {
46 char buf[PATH_MAX]; 46 char buf[PATH_MAX];
47 47
diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c
index 2ca9792..f7087cf 100644
--- a/LuaSL/src/LuaSL_test.c
+++ b/LuaSL/src/LuaSL_test.c
@@ -178,17 +178,13 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D
178 compileTime += me->compileTime; 178 compileTime += me->compileTime;
179 PI("Average compile speed is %f scripts per second", compiledCount / compileTime); 179 PI("Average compile speed is %f scripts per second", compiledCount / compileTime);
180 if (compiledCount == scriptCount) 180 if (compiledCount == scriptCount)
181 {
182 PI("*********************TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime)); 181 PI("*********************TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime));
183 }
184 } 182 }
185 PD("The compile of %s worked, running it now.", SID); 183 PD("The compile of %s worked, running it now.", SID);
186 sendForth(game, SID, "start()"); 184 sendForth(game, SID, "run()");
187 } 185 }
188 else 186 else
189 {
190 PI("Command %s from script %s", command, SID); 187 PI("Command %s from script %s", command, SID);
191 }
192 } 188 }
193 189
194 // Get the next blob to check it. 190 // Get the next blob to check it.