|
|
hi,
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 9/28/20 6:18 AM, jr wrote:
> > ...
> > Parse_String(concat("#declare ", name_, " = 123.45;"));
> > ...
>
> Expect most know, but on seeing this thread I added the follow comments
> to povr's string.inc file:
>
> // Parse a string you create (i.e., = concat(...)) - while parsing.
> // Use carefully. This macro a hack using a file which can collide
> // by name across invocations of povray or during multiple
> // simultaneous povray commands. Further, in opening and closing a
> // file it is also inefficient if done many times. Often it's
> // better to use the same "include defined strings for parsing"
> // idea by writing many 'to be parsed strings' to a file and then
> // include that single file by a name which you know and control.
> ...
wondering whether the recommendation should not follow Kenneth's preference (ie
cut/paste macro in to scene) since it is "self-modifying" code. also thinking,
wrt file name collision(s), perhaps a new version 2 of the macro could (should?)
be added to the POV-Ray/povr distributions, putting the user "in charge". eg:
#macro Parse_String_2(Fname, String)
#fopen FP Fname write
#write(FP, String)
#fclose FP
#include Fname
#end
regards, jr.
Post a reply to this message
|
|