aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-02-04 21:51:46 +1000
committerDavid Walter Seikel2016-02-04 21:51:46 +1000
commit888dde944292ec0b999114675f382e690faa2f87 (patch)
tree9e07e9f562c5ad3a7404f5ef5553ff51a781035d
parentI have no idea how long this has NOT been needed for. (diff)
downloadSledjHamr-888dde944292ec0b999114675f382e690faa2f87.zip
SledjHamr-888dde944292ec0b999114675f382e690faa2f87.tar.gz
SledjHamr-888dde944292ec0b999114675f382e690faa2f87.tar.bz2
SledjHamr-888dde944292ec0b999114675f382e690faa2f87.tar.xz
Various TODO items about parsing network commands.
-rw-r--r--TODO68
-rw-r--r--src/libraries/SledjHamr.c14
2 files changed, 73 insertions, 9 deletions
diff --git a/TODO b/TODO
index 4c75570..42d60a4 100644
--- a/TODO
+++ b/TODO
@@ -41,6 +41,8 @@ lib/LSL.lua Lua script that supplies all the LSL functions, and the basic LSL
41 "start()" while paused is handled special, and likely should stay that way. 41 "start()" while paused is handled special, and likely should stay that way.
42 Sets the environment to that of LSL.lua, unless it's an event, before calling pcall. 42 Sets the environment to that of LSL.lua, unless it's an event, before calling pcall.
43 Says it runs the return, but also sends the return via Runnr.send(nil, result1), which is commented out. 43 Says it runs the return, but also sends the return via Runnr.send(nil, result1), which is commented out.
44 What should happen is that instead of "return somevalue", it's just "someValue", but that could be "someValue + thingy".
45 So, execute it, return the result if returnWanted.
44 Sooo, doesn't do anything with the result, unless returnWanted. 46 Sooo, doesn't do anything with the result, unless returnWanted.
45 Returns whatever the pcall returns, if returWanted, which we don't during the main loop. 47 Returns whatever the pcall returns, if returWanted, which we don't during the main loop.
46 Some of the ll functions are defined as a wrapper around waitAndProcess, that first Runnr.send(nil, ...) the function call details. 48 Some of the ll functions are defined as a wrapper around waitAndProcess, that first Runnr.send(nil, ...) the function call details.
@@ -190,6 +192,11 @@ LuaSL sends world.say() to love. LuaSL accepts events.say() from love for scrip
190 world.say() -> events.say() 192 world.say() -> events.say()
191 193
192More generic event system? 194More generic event system?
195 Events are different from state changes. The Nails web page mostly
196 talks about the state of objects, and changing them. Events are for a
197 variety of things, not all of which can be represented by a state
198 change message.
199
193 There are other events flying around. 200 There are other events flying around.
194 BASIC event Just send it to LuaSL, it loops through all scripts, sending the event to them all if they have an event function in their current state. 201 BASIC event Just send it to LuaSL, it loops through all scripts, sending the event to them all if they have an event function in their current state.
195 REGISTER event Script has to register for these events with love. Can have filter. love loops through all regisitered "scripts", applies filters, sends events. 202 REGISTER event Script has to register for these events with love. Can have filter. love loops through all regisitered "scripts", applies filters, sends events.
@@ -211,15 +218,58 @@ More generic event system?
211 Event types can have filters? Events can be types? In otherwords, generic filter system, attach say filters to say type events, etc. 218 Event types can have filters? Events can be types? In otherwords, generic filter system, attach say filters to say type events, etc.
212 Figure this all out as we go along. 219 Figure this all out as we go along.
213 220
214 LuaSL 221parseStream() / send2() both -
215 events.* each scripts state has a bunch of these, incoming events from love, get sent to the currentstates event functions. 222 lookup command in conn->commands
216 world.* used to send commands to love. 223 if found, use that found function pointer
217 love 224 else
218 events.* used to send events to scripts, and viewers. 225 try conn->unknownCommand for the function pointer
219 world.* the real world object. 226 call the function pointer
220 extantz 227 or bitch / send to love
221 events.* used to get events from scripts and other viewers, via love. 228
222 world.* used to send commands to love. 229LuaSL
230 open a server stream
231 incoming -> parseStream()
232 commands scripts.compile(), scripts.run(), scripts.return(), etc.
233 unknown events.eventName() -> loop through each script looking for "function" = type(currentState.[eventName])
234 otherwise send2script()
235 bitch
236 outgoing -> send2()
237 commands scripts.state(), scripts.reset(), scripts.link_message(), and timer.*() commands currently in LuaSL_main.c->send2server()
238 unknown NULL
239 actually send it
240
241love
242 open a stream to LuaSL
243 incoming -> parseStream()
244 commands various compiling results, world functions, and event registrations / requests
245 unknown NULL
246 bitch
247 outgoing -> send2()
248 commands NULL
249 unknown NULL
250 filter as needed
251 actually send it
252 open a server stream
253 incoming -> parseStream()
254 commands various world functions, and event registrations
255 unknown NULL
256 bitch
257 outgoing -> send2()
258 commands NULL
259 unknown NULL
260 filter as needed
261 actually send it
262
263extantz
264 open a stream to love
265 incoming -> parseStream()
266 commands events.say(), events.dialog(), events.textBox(), events.loadSim()
267 unknown check for valid Lua
268 bitch
269 outgoing -> send2()
270 commands NULL
271 unknown NULL
272 actually send it
223 273
224 274
225 275
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c
index abd5b1c..b44c1cb 100644
--- a/src/libraries/SledjHamr.c
+++ b/src/libraries/SledjHamr.c
@@ -103,6 +103,9 @@ void send2(Connection *conn, const char *SID, const char *message, ...)
103 buf[length] = '\0'; 103 buf[length] = '\0';
104 104
105// TODO - Should check if this is always gonna be local? Likely not. 105// TODO - Should check if this is always gonna be local? Likely not.
106// TODO - Figure out what the above line meant. Then ...
107// Check a hashtable somewhere for a command extracted from the message.
108// conn->commands[command](message ...)
106 if (checkConnection(conn, "send2", conn->type, FALSE)) 109 if (checkConnection(conn, "send2", conn->type, FALSE))
107 { 110 {
108 switch (conn->type) 111 switch (conn->type)
@@ -157,6 +160,17 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
157 ext = index(command, ' '); 160 ext = index(command, ' ');
158 if (ext) 161 if (ext)
159 { 162 {
163 // TODO - Currently SID.command(arguments), should change that to nameSpace.command(arguments)
164 // Not sure what to do with SID, but there maybe some common parameters we can shift around differently.
165 // - First check if the connection has a hashtable of conn->commands.
166 //* Next check if "nameSpace.command(arguments)" runs as Lua.
167 // or even the return values from returnWanted calls like -
168 // SID, "return 1"
169 // SID, "result + 5"
170 // SID, "script.SID.return(1)"
171 // Finally pass it to conn->unknownCommand()
172 // * The Lua check can live in unknownCommand().
173 // else bitch.
160 streamParser func = eina_hash_find(conn->commands, command); 174 streamParser func = eina_hash_find(conn->commands, command);
161 175
162 ext[0] = '\0'; 176 ext[0] = '\0';