diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LSL.lua | 13 | ||||
-rw-r--r-- | LuaSL/src/LuaSL.h | 29 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_main.c | 12 |
3 files changed, 38 insertions, 16 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index 8861bf3..b8e2d4b 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -94,14 +94,19 @@ function args2string(doType, ...) | |||
94 | return temp | 94 | return temp |
95 | end | 95 | end |
96 | 96 | ||
97 | function mt.callAndReturn(name, ... ) | 97 | function mt.callAndReturn(name, ...) |
98 | print("mt.callAndReturn(" .. name .. "(" .. args2string(true, ...) .. "))") | 98 | luaproc.sendback(name .. "(" .. args2string(true, ...) .. ")") |
99 | end | 99 | end |
100 | 100 | ||
101 | function mt.callAndWait(name, ... ) | 101 | function mt.callAndWait(name, ...) |
102 | local func = functions[name] | 102 | local func = functions[name] |
103 | 103 | ||
104 | print("mt.callAndWait(" .. name .. "(" .. args2string(true, ...) .. "))") | 104 | mt.callAndReturn(name, ...); |
105 | |||
106 | --[[ TODO - do a luaproc sync receive() waiting for the result. | ||
107 | Eventually a sendForth() is called, which should end up passing through SendToChannel(). | ||
108 | The format of the result should be something like - SID.result({x=0.45, y=0.6, z=1.8}) | ||
109 | ]] | ||
105 | 110 | ||
106 | if "float" == func.Type then return 0.0 | 111 | if "float" == func.Type then return 0.0 |
107 | elseif "integer" == func.Type then return 0 | 112 | elseif "integer" == func.Type then return 0 |
diff --git a/LuaSL/src/LuaSL.h b/LuaSL/src/LuaSL.h index f6a5fad..6d495fa 100644 --- a/LuaSL/src/LuaSL.h +++ b/LuaSL/src/LuaSL.h | |||
@@ -49,17 +49,6 @@ typedef enum | |||
49 | 49 | ||
50 | typedef struct | 50 | typedef struct |
51 | { | 51 | { |
52 | char SID[PATH_MAX]; | ||
53 | char fileName[PATH_MAX]; | ||
54 | struct timeval startTime; | ||
55 | float compileTime; | ||
56 | int bugs, warnings; | ||
57 | boolean running; | ||
58 | |||
59 | } script; | ||
60 | |||
61 | typedef struct | ||
62 | { | ||
63 | Ecore_Evas *ee; // Our window. | 52 | Ecore_Evas *ee; // Our window. |
64 | Evas *canvas; // The canvas for drawing directly onto. | 53 | Evas *canvas; // The canvas for drawing directly onto. |
65 | Evas_Object *bg; // Our background edje, also the game specific stuff. | 54 | Evas_Object *bg; // Our background edje, also the game specific stuff. |
@@ -72,6 +61,24 @@ typedef struct | |||
72 | boolean ui; // Wether we actually start up the UI. | 61 | boolean ui; // Wether we actually start up the UI. |
73 | } gameGlobals; | 62 | } gameGlobals; |
74 | 63 | ||
64 | typedef struct | ||
65 | { | ||
66 | char SID[PATH_MAX]; | ||
67 | char fileName[PATH_MAX]; | ||
68 | struct timeval startTime; | ||
69 | float compileTime; | ||
70 | int bugs, warnings; | ||
71 | boolean running; | ||
72 | gameGlobals *game; | ||
73 | Ecore_Con_Client *client; | ||
74 | } script; | ||
75 | |||
76 | typedef struct | ||
77 | { | ||
78 | script *script; | ||
79 | const char message[PATH_MAX]; | ||
80 | } scriptMessage; | ||
81 | |||
75 | 82 | ||
76 | void loggingStartup(gameGlobals *game); | 83 | void loggingStartup(gameGlobals *game); |
77 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); | 84 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); |
diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c index e56aaf3..daee816 100644 --- a/LuaSL/src/LuaSL_main.c +++ b/LuaSL/src/LuaSL_main.c | |||
@@ -6,6 +6,14 @@ static int CPUs = 4; | |||
6 | static Eina_Strbuf *clientStream; | 6 | static Eina_Strbuf *clientStream; |
7 | 7 | ||
8 | 8 | ||
9 | static void _sendBack(void * data) | ||
10 | { | ||
11 | scriptMessage *message = data; | ||
12 | |||
13 | sendBack(message->script->game, message->script->client, message->script->SID, message->message); | ||
14 | free(message); | ||
15 | } | ||
16 | |||
9 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) | 17 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) |
10 | { | 18 | { |
11 | ecore_con_client_timeout_set(ev->client, 0); | 19 | ecore_con_client_timeout_set(ev->client, 0); |
@@ -54,6 +62,8 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D | |||
54 | gettimeofday(&me->startTime, NULL); | 62 | gettimeofday(&me->startTime, NULL); |
55 | strncpy(me->SID, SID, sizeof(me->SID)); | 63 | strncpy(me->SID, SID, sizeof(me->SID)); |
56 | strncpy(me->fileName, file, sizeof(me->fileName)); | 64 | strncpy(me->fileName, file, sizeof(me->fileName)); |
65 | me->game = game; | ||
66 | me->client = ev->client; | ||
57 | eina_hash_add(game->scripts, me->SID, me); | 67 | eina_hash_add(game->scripts, me->SID, me); |
58 | sendBack(game, ev->client, SID, "compiled(true)"); | 68 | sendBack(game, ev->client, SID, "compiled(true)"); |
59 | } | 69 | } |
@@ -69,7 +79,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D | |||
69 | if (me) | 79 | if (me) |
70 | { | 80 | { |
71 | sprintf(buf, "%s.lua.out", me->fileName); | 81 | sprintf(buf, "%s.lua.out", me->fileName); |
72 | newProc(buf, TRUE); | 82 | newProc(buf, TRUE, (Ecore_Cb) _sendBack, me); |
73 | } | 83 | } |
74 | } | 84 | } |
75 | else if (0 == strcmp(command, "exit()")) | 85 | else if (0 == strcmp(command, "exit()")) |