POV-Ray : Newsgroups : povray.general : Collision chance : Re: Collision chance Server Time
25 Apr 2024 15:33:41 EDT (-0400)
  Re: Collision chance  
From: Bald Eagle
Date: 24 Apr 2021 18:35:00
Message: <web.60849c6dcab749081f9dae3025979125@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.