From a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 11 Feb 2012 21:08:52 +1000 Subject: Neaten things up a bit. --- LuaSL/src/LuaSL.h | 3 --- LuaSL/src/LuaSL_LSL_tree.h | 3 +++ LuaSL/src/LuaSL_main.c | 32 ++++++++++++++++---------------- LuaSL/src/LuaSL_test.c | 20 ++++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) (limited to 'LuaSL/src') 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 } gameGlobals; -boolean compilerSetup(gameGlobals *game); -boolean compileLSL(gameGlobals *game, char *script, boolean doConstants); - void loggingStartup(gameGlobals *game); char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); 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 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 0efc65e..0aaf3c5 100644 --- a/LuaSL/src/LuaSL_main.c +++ b/LuaSL/src/LuaSL_main.c @@ -6,26 +6,13 @@ static int CPUs = 4; static Eina_Strbuf *clientStream; -Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) +static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) { ecore_con_client_timeout_set(ev->client, 0); return ECORE_CALLBACK_RENEW; } -Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) -{ - gameGlobals *game = data; - - if (ev->client) - { - PD("No more clients, exiting."); - ecore_con_client_del(ev->client); - ecore_main_loop_quit(); - } - return ECORE_CALLBACK_RENEW; -} - -Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) +static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) { gameGlobals *game = data; char SID[PATH_MAX]; @@ -81,6 +68,19 @@ Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev return ECORE_CALLBACK_RENEW; } +static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) +{ + gameGlobals *game = data; + + if (ev->client) + { + PD("No more clients, exiting."); + ecore_con_client_del(ev->client); + ecore_main_loop_quit(); + } + return ECORE_CALLBACK_RENEW; +} + int main(int argc, char **argv) { gameGlobals game; @@ -98,8 +98,8 @@ int main(int argc, char **argv) if ((game.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) { ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &game); - ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &game); ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &game); + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &game); ecore_con_server_timeout_set(game.server, 0); ecore_con_server_client_limit_set(game.server, -1, 0); 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) common_dirList(game, name, path, ".out", "quit"); } -Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) +static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) { gameGlobals *game = data; char buf[PATH_MAX]; @@ -124,7 +124,14 @@ Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) return ECORE_CALLBACK_RENEW; } -Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) +static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) +{ + gameGlobals *game = data; + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) { gameGlobals *game = data; @@ -138,13 +145,6 @@ Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) return ECORE_CALLBACK_RENEW; } -Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) -{ - gameGlobals *game = data; - - return ECORE_CALLBACK_RENEW; -} - int main(int argc, char **argv) { /* put here any init specific to this app like parsing args etc. */ @@ -165,8 +165,8 @@ int main(int argc, char **argv) if ((game.server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) { ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, &game); - ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, &game); ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb) _data, &game); + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, &game); if (ecore_evas_init()) { -- cgit v1.1