aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-10 21:40:04 +1000
committerDavid Walter Seikel2012-02-10 21:40:04 +1000
commit15e867dd789040923251c465a171586c11e1d15e (patch)
tree5b8def72c86b157359cfe671d3bf88945f27136d
parentCreate .omg files, sorta document them. (diff)
downloadSledjHamr-15e867dd789040923251c465a171586c11e1d15e.zip
SledjHamr-15e867dd789040923251c465a171586c11e1d15e.tar.gz
SledjHamr-15e867dd789040923251c465a171586c11e1d15e.tar.bz2
SledjHamr-15e867dd789040923251c465a171586c11e1d15e.tar.xz
More message sending design work.
-rw-r--r--LuaSL/src/LuaSL_runner.c86
1 files changed, 70 insertions, 16 deletions
diff --git a/LuaSL/src/LuaSL_runner.c b/LuaSL/src/LuaSL_runner.c
index 32f2c4e..f7f7a05 100644
--- a/LuaSL/src/LuaSL_runner.c
+++ b/LuaSL/src/LuaSL_runner.c
@@ -191,6 +191,21 @@ void runnerTearDown(gameGlobals *game)
191 * There is also an asset UUID (the one printed out on the console at script startup time) that points to the source code in the prim. 191 * There is also an asset UUID (the one printed out on the console at script startup time) that points to the source code in the prim.
192 * Which will be identical to the asset UUID for the multiple copies of the same script. 192 * Which will be identical to the asset UUID for the multiple copies of the same script.
193 * 193 *
194 * Object inventory "cache".
195 *
196 * This code currently pretends that there is a local file based sim object store available.
197 * I think it would be a good idea to abuse the OpenSim cache system to produce that file based object store.
198 * It will help with the "damn OpenSim's asset database has to be a bottomless pit" monster design flaw.
199 * Prim contents must all be unique names anyway, and there are SOME constraints on contents names, so probably don't have to do much to convert an item name to a legal file name.
200 * Oops, names can have directory slashes in them. lol
201 * On the other hand, sim objects CAN have the same name.
202 *
203 * So we got sim directories, with an objects directory inside it, with object directories inside that. The object directories have object files in them. This is all like the test setup that is here.
204 * We need metadata. Sim metadata, object metadata, and object contents metadata. That can be done with a "foo.omg" file at each level.
205 * sim/index.omg - the list of object name.UUIDs, their X,Y,Z location, size, and rotation.
206 * sim/objects/objectName_UUID/index.omg - the list of contents names, item UUIDs, asset UUIDs, and types.
207 * sim/objects/objectName/subObjectName - the list of ITS contents names, item UUIDs, asset UUIDs, and types.
208 *
194 * Script start, stop, reset. - OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs 209 * Script start, stop, reset. - OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
195 * 210 *
196 * Scripts and users have to be able to start, stop, and reset scripts. 211 * Scripts and users have to be able to start, stop, and reset scripts.
@@ -224,10 +239,64 @@ void runnerTearDown(gameGlobals *game)
224 * Before I hacked it up, actual message sending was done by copying the contents of the sending Lua states stack to the receiver states stack. 239 * Before I hacked it up, actual message sending was done by copying the contents of the sending Lua states stack to the receiver states stack.
225 * This is the simple method for the luaproc programmers, as both states are in the context of a luaproc call, so both stacks are available. 240 * This is the simple method for the luaproc programmers, as both states are in the context of a luaproc call, so both stacks are available.
226 * My hacked up version either takes one message from the sender, or is passed one from C. The C call just returns if there is no one waiting on that channel. 241 * My hacked up version either takes one message from the sender, or is passed one from C. The C call just returns if there is no one waiting on that channel.
227 * luaproc.send() cals that C function after taking a single message from the stack, and block waits as usual if the C call cannot deliver. 242 * luaproc.send() calls that C function after taking a single message from the stack, and block waits as usual if the C call cannot deliver.
228 * Don't think there is C to receive messages, luaproc seems to be lacking entirely in C side API. 243 * Don't think there is C to receive messages, luaproc seems to be lacking entirely in C side API.
244 * NOTE - Sending from C means that the message goes nowhere if no one is waiting for it.
245 * SOOOO, we may need to queue messages to.
246 * Just chuck them in a FIFO per channel, and destroy the FIFO when the channel get's destroyed.
229 * Edje messages might have to be used instead, or some hybrid. 247 * Edje messages might have to be used instead, or some hybrid.
230 * 248 *
249 * Main loop is waiting on messages, and that's the main driver. Luaproc is fine with that. Good for events.
250 * End of event handler -
251 * just wait for the next event.
252 * Stop a script from LSL -
253 * gotta find it's SID from it's name, and the prim UUID
254 * send the message
255 * wait for it to get the message - BUT we don't really want to wait.
256 * Stop a script from OpenSim -
257 * we should have it's SID from OpenSim, just send the message from C, no need to wait.
258 * Start a script -
259 * if it's stopped, it's already waiting for the message.
260 * if it's not stopped, then we don't care. BUT then we might be waiting for it to get the message if starting it from LSL.
261 * Reset a script -
262 * probably should be done from C anyway, and can reuse the libraries like luaproc likes to do.
263 * ask C to reset it.
264 * LSL calls a function we have to hand to OpenSim -
265 * send the message to C, wait.
266 * C eventually sends a message back.
267 * Sleep -
268 * tell C it's waiting for the wake up message.
269 * wait for the wake up message.
270 *
271 * C needs -
272 * Lua call for stop script.
273 * get the SID from the name, and the prim UUID.
274 * send the stop message to the SID.
275 * send something to OpenSim so it knows.
276 * return to Lua.
277 * Lua call for start script.
278 * get the SID from the name, and the prim UUID.
279 * send the start message to the SID.
280 * send something to OpenSim so it knows.
281 * return to Lua.
282 * Lua call for reset other script.
283 * get the SID from the name, and the prim UUID.
284 * figure out which Lua state it is.
285 * fall through to "reset this script", only with the script set to the found one.
286 * Lua call for reset this script.
287 * get luaproc to close this Lua state
288 * reload the script file
289 * start it again, reusing the previous Lua state, or which ever one luaproc wants to use.
290 * Lua call for sending a function to OpenSim.
291 * Lua first strings up the function call and args, with SID.
292 * C packs it off to opensim.
293 * C puts Lua state on the "waiting for message" queue if a return value is needed.
294 * OpenSim sends back the return value, business as usual.
295 * Lua call for sleep.
296 * setup an ecore timer callback
297 * put the Lua state into "waiting for message" queue.
298 * ecore timer callback sends the wake up message.
299 *
231 * Time and timers, plus deal with time dilation. 300 * Time and timers, plus deal with time dilation.
232 * 301 *
233 * Various LSL functions deal with time, that's no problem. 302 * Various LSL functions deal with time, that's no problem.
@@ -251,19 +320,4 @@ void runnerTearDown(gameGlobals *game)
251 * Note that doing it ourselves may cause issues with OpenSim doing it for some other script engine. 320 * Note that doing it ourselves may cause issues with OpenSim doing it for some other script engine.
252 * Azy might be suitable, but it's also in prototype. 321 * Azy might be suitable, but it's also in prototype.
253 * 322 *
254 * Object inventory "cache".
255 *
256 * This code currently pretends that there is a local file based sim object store available.
257 * I think it would be a good idea to abuse the OpenSim cache system to produce that file based object store.
258 * It will help with the "damn OpenSim's asset database has to be a bottomless pit" monster design flaw.
259 * Prim contents must all be unique names anyway, and there are SOME constraints on contents names, so probably don't have to do much to convert an item name to a legal file name.
260 * Oops, names can have directory slashes in them. lol
261 * On the other hand, sim objects CAN have the same name.
262 *
263 * So we got sim directories, with an objects directory inside it, with object directories inside that. The object directories have object files in them. This is all like the test setup that is here.
264 * We need metadata. Sim metadata, object metadata, and object contents metadata. That can be done with a "foo.omg" file at each level.
265 * sim/index.omg - the list of object name.UUIDs, their X,Y,Z location, size, and rotation.
266 * sim/objects/objectName_UUID/index.omg - the list of contents names, item UUIDs, asset UUIDs, and types.
267 * sim/objects/objectName/subObjectName - the list of ITS contents names, item UUIDs, asset UUIDs, and types.
268 *
269*/ 323*/