aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-08-10 04:30:50 +1000
committerDavid Walter Seikel2014-08-10 04:30:50 +1000
commitdeb9a0da1b308eedcff73934440507f34d9638f9 (patch)
tree51ef55a34dd9a2ffacd95c57d7a91498213a18ff /src
parentBetter separation between compiling and running LSL scripts. (diff)
downloadSledjHamr-deb9a0da1b308eedcff73934440507f34d9638f9.zip
SledjHamr-deb9a0da1b308eedcff73934440507f34d9638f9.tar.gz
SledjHamr-deb9a0da1b308eedcff73934440507f34d9638f9.tar.bz2
SledjHamr-deb9a0da1b308eedcff73934440507f34d9638f9.tar.xz
More comments.
Diffstat (limited to 'src')
-rw-r--r--src/libraries/Runnr.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c
index 3aaa570..760a860 100644
--- a/src/libraries/Runnr.c
+++ b/src/libraries/Runnr.c
@@ -411,6 +411,74 @@ static int luaWriter(lua_State *L, const void* p, size_t sz, void* ud)
411} 411}
412 412
413// TODO - This didn't help the compile time much, perhaps move the rest of the compiling stage into this thread as a callback? 413// TODO - This didn't help the compile time much, perhaps move the rest of the compiling stage into this thread as a callback?
414/*
415
416LuaSL.c : _data( ... "compile(" ...
417 allocate LuaSL_compiler
418 extract SID, file, and name from data stream
419 massage data into LuaCompiler
420 compileLSL(LuaCompiler, FALSE)
421LuaSL_compile.c : compileLSL()
422 init it
423* open the .LSL file
424* init lexer
425* run lexer in a loop
426* setup second pass in a loop
427* may do a sendBack()
428* secondPass(LuaSL_compiler, ... )
429* open the .lua file
430* generate Lua source code
431 compileScript(LuaSL_compiler)
432Runnr;c : compileScript(
433 start a feedback thread
434
435LuaSL.c : _compileCb
436 scriptAdd( ... )
437 Needs LuaCompiler-> file, SID, client, data
438 adds the compiled script to the list of scripts being run.
439 sendBack results
440 frees LuaCompiler-> luaName, SID, file. Alse frees LuaCompiler.
441
442
443typedef void (* compileCb)(LuaCompile *compiler);
444
445typedef struct _LuaCompile
446{
447 char *file, *SID, *luaName;
448 int bugCount;
449 void *data; OurGlobals, Passed to the call back, to be passed to scriptAdd, which stores it as a void pointer, then ... ????? Don't think it's actually used.
450 Ecore_Con_Client *client;
451 compileCb parser;
452 compileCb cb;
453} LuaCompiler;
454
455typedef struct
456{
457 LuaCompiler compiler;
458 void *scanner; // This should be of type yyscan_t, which is typedef to void * anyway, but that does not get defined until LuaSL_lexer.h, which depends on this struct being defined first.
459 int argc;
460 char **argv;
461 FILE *file;
462 LSL_Leaf *ast;
463 LSL_Script script;
464 LSL_State state;
465#if LUASL_DIFF_CHECK
466 Eina_Strbuf *ignorable;
467#endif
468 LSL_Leaf *lval;
469 LSL_Block *currentBlock;
470 LSL_Function *currentFunction;
471 Eina_Clist danglingCalls; // HEAD for function calls used before the function is defined.
472 int column, line;
473 int undeclared;
474 boolean inState;
475 boolean doConstants;
476 boolean result;
477} LuaSL_compiler;
478
479
480*/
481
414static void _compileNotify(void *data, Ecore_Thread *thread, void *message) 482static void _compileNotify(void *data, Ecore_Thread *thread, void *message)
415{ 483{
416 LuaCompiler *compiler = data; 484 LuaCompiler *compiler = data;
@@ -420,6 +488,7 @@ static void _compileNotify(void *data, Ecore_Thread *thread, void *message)
420 488
421// TODO - Should pass error messages back through a linked list. 489// TODO - Should pass error messages back through a linked list.
422// To eventually get passed back to the calling app via compiler->cb 490// To eventually get passed back to the calling app via compiler->cb
491// We use - luaName, bugCount, cb
423static void _compileThread(void *data, Ecore_Thread *thread) 492static void _compileThread(void *data, Ecore_Thread *thread)
424{ 493{
425 LuaCompiler *compiler = data; 494 LuaCompiler *compiler = data;