aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/love
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-23 13:22:36 +1000
committerDavid Walter Seikel2014-05-23 13:22:36 +1000
commitf97c73bd1e43a0eb32ad8dc43fc28f6e40b28f38 (patch)
treedf45770acc4a26d56e45bc7ae3420cddb6522d15 /src/love
parentTODO-- (diff)
downloadSledjHamr-f97c73bd1e43a0eb32ad8dc43fc28f6e40b28f38.zip
SledjHamr-f97c73bd1e43a0eb32ad8dc43fc28f6e40b28f38.tar.gz
SledjHamr-f97c73bd1e43a0eb32ad8dc43fc28f6e40b28f38.tar.bz2
SledjHamr-f97c73bd1e43a0eb32ad8dc43fc28f6e40b28f38.tar.xz
Rewrite the LuaSL script running stuff (twice lol), plus much related tweakage and cleanups.
Diffstat (limited to 'src/love')
-rwxr-xr-xsrc/love/build.lua1
-rw-r--r--src/love/love.c20
2 files changed, 9 insertions, 12 deletions
diff --git a/src/love/build.lua b/src/love/build.lua
index 5ecca31..8fd9a29 100755
--- a/src/love/build.lua
+++ b/src/love/build.lua
@@ -17,5 +17,4 @@ end
17removeFiles(dir, {'../../love', '*.o', '../../media/love.edj'}) 17removeFiles(dir, {'../../love', '*.o', '../../media/love.edj'})
18 18
19runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' love.edc ../../media/love.edj') 19runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' love.edc ../../media/love.edj')
20
21compileFiles('../../love', dir, {'love'}, '') 20compileFiles('../../love', dir, {'love'}, '')
diff --git a/src/love/love.c b/src/love/love.c
index 1f885bc..d194f11 100644
--- a/src/love/love.c
+++ b/src/love/love.c
@@ -44,7 +44,7 @@ typedef struct _gameGlobals
44 boolean ui; // Wether we actually start up the UI. 44 boolean ui; // Wether we actually start up the UI.
45} gameGlobals; 45} gameGlobals;
46 46
47typedef struct _script 47typedef struct _Lscript
48{ 48{
49 char SID[PATH_MAX]; 49 char SID[PATH_MAX];
50 char fileName[PATH_MAX]; 50 char fileName[PATH_MAX];
@@ -52,11 +52,10 @@ typedef struct _script
52 float compileTime; 52 float compileTime;
53 int bugs, warnings; 53 int bugs, warnings;
54 boolean running; 54 boolean running;
55} script; 55} LoveScript;
56 56
57 57
58int logDom = -1; // Our logging domain. 58int logDom = -1; // Our logging domain.
59//static int CPUs = 4;
60static Eina_Strbuf *LuaSLStream; 59static Eina_Strbuf *LuaSLStream;
61static Eina_Strbuf *clientStream; 60static Eina_Strbuf *clientStream;
62static int scriptCount = 0; 61static int scriptCount = 0;
@@ -145,7 +144,7 @@ static void dirList_compile(const char *name, const char *path, void *data)
145 // TODO - We are leaking these, coz we don't know when scripts get deleted in the script server. 144 // TODO - We are leaking these, coz we don't know when scripts get deleted in the script server.
146 // On the other hand, the main use for this is a temporary hack that sends events to all scripts. 145 // On the other hand, the main use for this is a temporary hack that sends events to all scripts.
147 // So that part will get a rewrite when we make it real later anyway. 146 // So that part will get a rewrite when we make it real later anyway.
148 script *me = calloc(1, sizeof(script)); 147 LoveScript *me = calloc(1, sizeof(LoveScript));
149 148
150 scriptCount++; 149 scriptCount++;
151 gettimeofday(&me->startTime, NULL); 150 gettimeofday(&me->startTime, NULL);
@@ -213,7 +212,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e
213 ext = index(SID, '.'); 212 ext = index(SID, '.');
214 if (ext) 213 if (ext)
215 { 214 {
216 script *me; 215 LoveScript *me;
217 216
218 ext[0] = '\0'; 217 ext[0] = '\0';
219 command = ext + 1; 218 command = ext + 1;
@@ -383,7 +382,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e
383 else if (0 == strncmp(command, "llMessageLinked(", 16)) 382 else if (0 == strncmp(command, "llMessageLinked(", 16))
384 { 383 {
385 Eina_Iterator *scripts; 384 Eina_Iterator *scripts;
386 script *me; 385 LoveScript *me;
387 386
388 // TODO - For now, just send it to everyone. 387 // TODO - For now, just send it to everyone.
389 scripts = eina_hash_iterator_data_new(ourGlobals->scripts); 388 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
@@ -419,7 +418,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e
419 if (-1 != fd) 418 if (-1 != fd)
420 { 419 {
421 Eina_Iterator *scripts; 420 Eina_Iterator *scripts;
422 script *me; 421 LoveScript *me;
423 long len; 422 long len;
424 423
425 temp = NULL; 424 temp = NULL;
@@ -542,7 +541,7 @@ static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *
542 if (0 == strncmp(command, "events.touch_start(", 19)) 541 if (0 == strncmp(command, "events.touch_start(", 19))
543 { 542 {
544 Eina_Iterator *scripts; 543 Eina_Iterator *scripts;
545 script *me; 544 LoveScript *me;
546 545
547 // TODO - For now, just send it to everyone. 546 // TODO - For now, just send it to everyone.
548 scripts = eina_hash_iterator_data_new(ourGlobals->scripts); 547 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
@@ -557,7 +556,7 @@ static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *
557 else if (0 == strncmp(command, "events.listen(", 14)) 556 else if (0 == strncmp(command, "events.listen(", 14))
558 { 557 {
559 Eina_Iterator *scripts; 558 Eina_Iterator *scripts;
560 script *me; 559 LoveScript *me;
561 560
562 // TODO - For now, just send it to everyone. 561 // TODO - For now, just send it to everyone.
563 scripts = eina_hash_iterator_data_new(ourGlobals->scripts); 562 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
@@ -586,7 +585,7 @@ static Eina_Bool _delClient(void *data, int type, Ecore_Con_Event_Client_Del *ev
586 { 585 {
587 Eina_List const *clients; 586 Eina_List const *clients;
588 587
589 // This is only really for testing, normally it just runs 24/7, or until told to. 588 // This is only really for testing, normally it just runs 24/7, or until told not to.
590 clients = ecore_con_server_clients_get(ourGlobals->server); 589 clients = ecore_con_server_clients_get(ourGlobals->server);
591 if (0 == eina_list_count(clients)) 590 if (0 == eina_list_count(clients))
592 { 591 {
@@ -606,7 +605,6 @@ static Eina_Bool _delClient(void *data, int type, Ecore_Con_Event_Client_Del *ev
606 605
607int main(int argc, char **argv) 606int main(int argc, char **argv)
608{ 607{
609 /* put here any init specific to this app like parsing args etc. */
610 gameGlobals ourGlobals; 608 gameGlobals ourGlobals;
611 char *programName = argv[0]; 609 char *programName = argv[0];
612 boolean badArgs = FALSE; 610 boolean badArgs = FALSE;