Hello,
What is the best way for run scripts to access @-variables?
I found out about the vardict file, whose path is passed to run scripts via the tup_vardict environment variable. However, neither its existence nor its format are documented. Is it meant to be used by run scripts?
Its format seems to be:
- First, a dump of the unsigned int holding the amount of @-variables. In my platform, that's 4 bytes and little endian.
- Then, the index, as a series of unsigned ints (again 4 bytes each and little endian on my platform). Each value represents the offset at which the corresponding variable starts (after the index).
- Finally, a 0-ended line for each @-variable, with the equal sign between the variable and its value.
Is my understanding right? If so, could the format be made more portable, instead of depending on the platform's type sizes and endianness? Could we perhaps switch to JSON instead? I would be happy to author the necessary changes.
Passing the value of the @-variable in the Tupfile would also work:
run ./script.sh @(FOOBAR)
However, the vardict approach would be cleaner.
Kind regards,
David