diff options
author | David Walter Seikel | 2012-02-11 21:08:52 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-11 21:08:52 +1000 |
commit | a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69 (patch) | |
tree | f898cec7f89e1259277c295fd198e8385fc21384 /LuaSL | |
parent | LuaSL_main is pretty small now, LuaSL_runner is mostly comment. Merge them. (diff) | |
download | SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.zip SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.tar.gz SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.tar.bz2 SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.tar.xz |
Neaten things up a bit.
Diffstat (limited to 'LuaSL')
-rw-r--r-- | LuaSL/src/LuaSL.h | 3 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 3 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_main.c | 32 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_test.c | 20 |
4 files changed, 29 insertions, 29 deletions
diff --git a/LuaSL/src/LuaSL.h b/LuaSL/src/LuaSL.h index a3bf3cb..8f5b58a 100644 --- a/LuaSL/src/LuaSL.h +++ b/LuaSL/src/LuaSL.h | |||
@@ -61,9 +61,6 @@ typedef struct | |||
61 | } gameGlobals; | 61 | } gameGlobals; |
62 | 62 | ||
63 | 63 | ||
64 | boolean compilerSetup(gameGlobals *game); | ||
65 | boolean compileLSL(gameGlobals *game, char *script, boolean doConstants); | ||
66 | |||
67 | void loggingStartup(gameGlobals *game); | 64 | void loggingStartup(gameGlobals *game); |
68 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); | 65 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); |
69 | float timeDiff(struct timeval *now, struct timeval *then); | 66 | float timeDiff(struct timeval *now, struct timeval *then); |
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 435cf65..4d50242 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -438,6 +438,9 @@ LSL_Leaf *collectArguments(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *c | |||
438 | LSL_Leaf *collectParameters(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); | 438 | LSL_Leaf *collectParameters(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); |
439 | LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *newStatement); | 439 | LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *newStatement); |
440 | 440 | ||
441 | boolean compilerSetup(gameGlobals *game); | ||
442 | boolean compileLSL(gameGlobals *game, char *script, boolean doConstants); | ||
443 | |||
441 | void *ParseAlloc(void *(*mallocProc)(size_t)); | 444 | void *ParseAlloc(void *(*mallocProc)(size_t)); |
442 | void ParseTrace(FILE *TraceFILE, char *zTracePrompt); | 445 | void ParseTrace(FILE *TraceFILE, char *zTracePrompt); |
443 | void Parse(void *yyp, int yymajor, LSL_Leaf *yyminor, LuaSL_compiler *compiler); | 446 | 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 0efc65e..0aaf3c5 100644 --- a/LuaSL/src/LuaSL_main.c +++ b/LuaSL/src/LuaSL_main.c | |||
@@ -6,26 +6,13 @@ static int CPUs = 4; | |||
6 | static Eina_Strbuf *clientStream; | 6 | static Eina_Strbuf *clientStream; |
7 | 7 | ||
8 | 8 | ||
9 | Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) | 9 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) |
10 | { | 10 | { |
11 | ecore_con_client_timeout_set(ev->client, 0); | 11 | ecore_con_client_timeout_set(ev->client, 0); |
12 | return ECORE_CALLBACK_RENEW; | 12 | return ECORE_CALLBACK_RENEW; |
13 | } | 13 | } |
14 | 14 | ||
15 | Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) | 15 | static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) |
16 | { | ||
17 | gameGlobals *game = data; | ||
18 | |||
19 | if (ev->client) | ||
20 | { | ||
21 | PD("No more clients, exiting."); | ||
22 | ecore_con_client_del(ev->client); | ||
23 | ecore_main_loop_quit(); | ||
24 | } | ||
25 | return ECORE_CALLBACK_RENEW; | ||
26 | } | ||
27 | |||
28 | Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) | ||
29 | { | 16 | { |
30 | gameGlobals *game = data; | 17 | gameGlobals *game = data; |
31 | char SID[PATH_MAX]; | 18 | char SID[PATH_MAX]; |
@@ -81,6 +68,19 @@ Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev | |||
81 | return ECORE_CALLBACK_RENEW; | 68 | return ECORE_CALLBACK_RENEW; |
82 | } | 69 | } |
83 | 70 | ||
71 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) | ||
72 | { | ||
73 | gameGlobals *game = data; | ||
74 | |||
75 | if (ev->client) | ||
76 | { | ||
77 | PD("No more clients, exiting."); | ||
78 | ecore_con_client_del(ev->client); | ||
79 | ecore_main_loop_quit(); | ||
80 | } | ||
81 | return ECORE_CALLBACK_RENEW; | ||
82 | } | ||
83 | |||
84 | int main(int argc, char **argv) | 84 | int main(int argc, char **argv) |
85 | { | 85 | { |
86 | gameGlobals game; | 86 | gameGlobals game; |
@@ -98,8 +98,8 @@ int main(int argc, char **argv) | |||
98 | if ((game.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) | 98 | if ((game.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) |
99 | { | 99 | { |
100 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &game); | 100 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &game); |
101 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &game); | ||
102 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &game); | 101 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &game); |
102 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &game); | ||
103 | ecore_con_server_timeout_set(game.server, 0); | 103 | ecore_con_server_timeout_set(game.server, 0); |
104 | ecore_con_server_client_limit_set(game.server, -1, 0); | 104 | ecore_con_server_client_limit_set(game.server, -1, 0); |
105 | clientStream = eina_strbuf_new(); | 105 | clientStream = eina_strbuf_new(); |
diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c index 91ad152..f49a9f5 100644 --- a/LuaSL/src/LuaSL_test.c +++ b/LuaSL/src/LuaSL_test.c | |||
@@ -104,7 +104,7 @@ static void dirList_quit(const char *name, const char *path, void *data) | |||
104 | common_dirList(game, name, path, ".out", "quit"); | 104 | common_dirList(game, name, path, ".out", "quit"); |
105 | } | 105 | } |
106 | 106 | ||
107 | Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) | 107 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) |
108 | { | 108 | { |
109 | gameGlobals *game = data; | 109 | gameGlobals *game = data; |
110 | char buf[PATH_MAX]; | 110 | char buf[PATH_MAX]; |
@@ -124,7 +124,14 @@ Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) | |||
124 | return ECORE_CALLBACK_RENEW; | 124 | return ECORE_CALLBACK_RENEW; |
125 | } | 125 | } |
126 | 126 | ||
127 | Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) | 127 | static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) |
128 | { | ||
129 | gameGlobals *game = data; | ||
130 | |||
131 | return ECORE_CALLBACK_RENEW; | ||
132 | } | ||
133 | |||
134 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) | ||
128 | { | 135 | { |
129 | gameGlobals *game = data; | 136 | gameGlobals *game = data; |
130 | 137 | ||
@@ -138,13 +145,6 @@ Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) | |||
138 | return ECORE_CALLBACK_RENEW; | 145 | return ECORE_CALLBACK_RENEW; |
139 | } | 146 | } |
140 | 147 | ||
141 | Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) | ||
142 | { | ||
143 | gameGlobals *game = data; | ||
144 | |||
145 | return ECORE_CALLBACK_RENEW; | ||
146 | } | ||
147 | |||
148 | int main(int argc, char **argv) | 148 | int main(int argc, char **argv) |
149 | { | 149 | { |
150 | /* put here any init specific to this app like parsing args etc. */ | 150 | /* put here any init specific to this app like parsing args etc. */ |
@@ -165,8 +165,8 @@ int main(int argc, char **argv) | |||
165 | if ((game.server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) | 165 | if ((game.server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) |
166 | { | 166 | { |
167 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, &game); | 167 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, &game); |
168 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, &game); | ||
169 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb) _data, &game); | 168 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb) _data, &game); |
169 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, &game); | ||
170 | 170 | ||
171 | if (ecore_evas_init()) | 171 | if (ecore_evas_init()) |
172 | { | 172 | { |