I’m making a parser for .scsyndef
files and noticed some weird things in the spec particularly in the bit dealing with parameters. The spec says
- int32 - number of parameters (P)
- [float32] * P - initial parameter values
- int32 - number of parameter names (N)
- [ param-name ] * N
- pstring - the name of the parameter
- int32 - its index in the parameter array
which ends up looking something like
const numInitialValues = int32();
let initialValues = [];
for (let i = 0; i < numInitialValues; i++) {
initialValues.push(float32());
}
const numParamNames = int32();
let paramNames = [];
for (let i = 0; i < numParamNames; i++) {
const name = pstring();
const index = int32();
paramNames[index] = name;
}
// Merge names and values arrays
// ...
(Simplified version of my actual code)
This confuses me a lot. Why is the number of parameter names stored seperately from the number of initial values? Why do the parameter names have an index specified when the values don’t? How come initial values come first then the parameter names?
I know these are highly specific questions and probably difficult to answer so any thoughts or pointers would be greatly appreciated.
Thanks!