ingo <ing### [at] tagpovrayorg> wrote:
> Currently I'm working on a sequencer and ADSR. They require a lot of
> array manipulation. The system I use, give everything a name, works quite
> well. The names get long and I'd like to shorten them. Hence the question,
> what are the chance on collisions with names from other file for only
> #local names. I'd like to drop the _sq bit but then I'm left with rather
> general names like _out.
What if you took everything that you wanted to have in a namespace and put them
into an include file.
Each include file could have a number associated with it.
Then instead of hard-coding the names and value assignments, you could use the
parse_string macro to make identifiers like _out1, _out2, etc.
Make a little macro like:
Declare (Lvalue, value)
so that the code reads mostly like usual and there's not a lot of extra code.
When you include one of these files, the first thing it does is check to see if
a global counter variable is set, and what its value is. Then it uses the next
greater integer for its Lvalue names.
Then you could mix and match them any way you wanted, and you'd _always_ be
guaranteed to have distinct names.
Post a reply to this message