From a0263e9618f37101d4beb182853b653fe4727667 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 12 Feb 2012 00:22:36 +1000 Subject: Little clean ups. --- LuaSL/src/LSL.lua | 11 ++++++----- LuaSL/src/LuaSL_LSL_tree.h | 7 ++++--- LuaSL/src/LuaSL_main.c | 2 +- LuaSL/src/LuaSL_test.c | 6 +----- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'LuaSL') 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 local paused = false -- Stuff called from the wire protocol has to be global, but I think this means just global to this file. -function pause() paused = true end +function stop() paused = true end function quit() running = false end function LSL.stateChange(x) @@ -580,15 +580,16 @@ function LSL.mainLoop(sid, x) LSL.stateChange(x); - -- 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. - -- Actually, I think the luaproc message system manages such a queue for us anyway. - -- 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. + -- Need a FIFO queue of incoming events. Which will be in the C main thread, coz that's listening on the socket for us. + -- The ecore_con stuff ends up being a sorta FIFO queue of the commands coming from OpenSim. + -- Plus, I think the luaproc message system manages a FIFO queue for us as well. + -- Might still need one. lol while running do local message = luaproc.receive(sid) if message then if paused then - if "resume()" == message then paused = false end + if "start()" == message then paused = false end else 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 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 #endif + +boolean compilerSetup(gameGlobals *game); +boolean compileLSL(gameGlobals *game, char *script, boolean doConstants); void burnLeaf(void *data); + LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); LSL_Leaf *addCrement(LuaSL_compiler *compiler, LSL_Leaf *variable, LSL_Leaf *crement, LSL_Type type); LSL_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 LSL_Leaf *collectParameters(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *newStatement); -boolean compilerSetup(gameGlobals *game); -boolean compileLSL(gameGlobals *game, char *script, boolean doConstants); - void *ParseAlloc(void *(*mallocProc)(size_t)); void ParseTrace(FILE *TraceFILE, char *zTracePrompt); void 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 else sendBack(game, ev->client, SID, "compiled(false)"); } - else if (0 == strcmp(command, "start()")) + else if (0 == strcmp(command, "run()")) { char buf[PATH_MAX]; 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 compileTime += me->compileTime; PI("Average compile speed is %f scripts per second", compiledCount / compileTime); if (compiledCount == scriptCount) - { PI("*********************TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime)); - } } PD("The compile of %s worked, running it now.", SID); - sendForth(game, SID, "start()"); + sendForth(game, SID, "run()"); } else - { PI("Command %s from script %s", command, SID); - } } // Get the next blob to check it. -- cgit v1.1