aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-02-06 00:34:40 +1000
committerDavid Walter Seikel2016-02-06 00:34:40 +1000
commitfc670e572c3ea132764a559f817c68a917a9d3a5 (patch)
treebb0f8d86564bc2505b4089655ab61cfe824935c4
parentActually use the command hash. A little. (diff)
downloadSledjHamr-fc670e572c3ea132764a559f817c68a917a9d3a5.zip
SledjHamr-fc670e572c3ea132764a559f817c68a917a9d3a5.tar.gz
SledjHamr-fc670e572c3ea132764a559f817c68a917a9d3a5.tar.bz2
SledjHamr-fc670e572c3ea132764a559f817c68a917a9d3a5.tar.xz
Move return() to the hashed commands.
-rw-r--r--src/LuaSL/LuaSL_main.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index f131429..0e70fe4 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -284,6 +284,18 @@ static boolean _commandRun(void *data, Connection *connection, char *SID, char *
284 return TRUE; 284 return TRUE;
285} 285}
286 286
287static boolean _commandReturn(void *data, Connection *connection, char *SID, char *command, char *arguments)
288{
289 char buf[PATH_MAX];
290
291 snprintf(buf, sizeof(buf), "%s(%s)", command, arguments);
292//PD("Sending -> script %s : %s", SID, buf);
293 send2script(SID, buf);
294
295 return TRUE;
296}
297
298
287static boolean _commandExit(void *data, Connection *connection, char *SID, char *command, char *arguments) 299static boolean _commandExit(void *data, Connection *connection, char *SID, char *command, char *arguments)
288{ 300{
289 PI("Told to exit."); 301 PI("Told to exit.");
@@ -292,19 +304,15 @@ static boolean _commandExit(void *data, Connection *connection, char *SID, char
292 return TRUE; 304 return TRUE;
293} 305}
294 306
307// TODO - Still needed for event stuff. Fix that later.
295static boolean parser(void *data, Connection *connection, char *SID, char *command, char *arguments) 308static boolean parser(void *data, Connection *connection, char *SID, char *command, char *arguments)
296{ 309{
297 char buf[PATH_MAX]; 310 char buf[PATH_MAX];
298 311
299//PD("PARSE COMMAND %s - %s (%s)", SID, command, arguments); 312//PD("PARSE COMMAND %s - %s (%s)", SID, command, arguments);
300 // TODO - This bit might still remain, unless script.return() can make it go away? 313 snprintf(buf, sizeof(buf), "%s(%s)", command, arguments);
301 // Though perhaps the "else" part stays?
302// if (0 == strcmp("return", command))
303// snprintf(buf, sizeof(buf), "%s(%s)", command, arguments);
304// else
305 snprintf(buf, sizeof(buf), "%s(%s)", command, arguments);
306//PD("Sending -> script %s : %s", SID, buf); 314//PD("Sending -> script %s : %s", SID, buf);
307 send2script(SID, buf); 315 send2script(SID, buf);
308 316
309 return TRUE; 317 return TRUE;
310} 318}
@@ -352,6 +360,7 @@ int main(int argc, char **argv)
352 360
353 eina_hash_add(conn->commands, "compile", _commandCompile); 361 eina_hash_add(conn->commands, "compile", _commandCompile);
354 eina_hash_add(conn->commands, "run", _commandRun); 362 eina_hash_add(conn->commands, "run", _commandRun);
363 eina_hash_add(conn->commands, "return", _commandReturn);
355 eina_hash_add(conn->commands, "exit", _commandExit); 364 eina_hash_add(conn->commands, "exit", _commandExit);
356 365
357 result = 0; 366 result = 0;