|
|
On 9/28/20 6:18 AM, jr wrote:
...
>
> #include "strings.inc"
>
> #macro Abc(s_)
> #debug concat(s_, " = ", str(Parse_String(s_),0,2), "\n")
> #end
>
> #declare name_ = "U";
>
> Parse_String(concat("#declare ", name_, " = 123.45;"));
>
> Abc(name_)
>
...
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.
#macro Parse_String(String)
#fopen FOut "parse_string.tmp" write
#write(FOut,String)
#fclose FOut
#include "parse_string.tmp"
#end
Bill P.
Post a reply to this message
|
|