Before I sort out variables and arrays, I’d like to get the prototypes for tele_op_t.get and tele_op_t.set sorted. The intention is that those functions will not have access to any global variables, and instead access everything via the arguments passed in.
I think I’m going to go with
void (*get)(const void *data, tele_global_state_t *g, tele_exec_state_t *e, tele_command_state_t *c);
(if you’ve got alternate names for the structs shout out, I generally prefer verbose names when the scope is large)
I’ve gone with 3 different structs to illustrate the different types of states we have, and so that (via the NOTUSED macro) we can document what state an op manipulates.
-
tele_global_state_t will (eventually) contain:
- scripts
- timeline
- variables & arrays
- patterns
- delays
- mutes
- the S stack
-
tele_exec_state_t is designed to hold the ‘execution context’ for a series of commands (e.g. a script):
-
IF / ELSE condition (and thus stop the status of condition leaking)
- commands executed (see this ticket)
-
tele_command_state_t will contain:
- the stack
It’s possible that we might want to eventual split tele_global_state_t into 2 types, that which is saved with the scene and that which is not to make scene management easier.
I’d consider merging tele_exec_state_t and tele_command_state_t if there is a strong demand, but my gut says not to.
In case it’s not obvious, I’m not actually planning on doing all of this now! Only the variables and arrays (and maybe the stack), but I’m trying to get the foundations in place to do it over time.
One more question, what is the PRESET variable for? It doesn’t appear to have any special use, other than being an undocumented variable. Can I just delete it?