POV-Ray : Newsgroups : povray.general : Parse_String : Parse_String Server Time
3 Aug 2024 08:08:36 EDT (-0400)
  Parse_String  
From: Florian Brucker
Date: 31 Mar 2004 07:08:12
Message: <406ab4ac@news.povray.org>
When working with Parse_String from strings.inc I noticed that you 
cannot use it to create multiple macros on the fly. This is because the 
macro overwrites the file it parses from every time, and so the filename 
for each macro (which is saved internally IIRC) is the same. The errors 
you'll get are a bit confusing, though :)

It's of course no problem to get around this:

<POV>
//parse string macro which parses each time from a different file
#declare so_ParseStringCount = 0;

#macro so_ParseString(S)
     #local Filename = 
concat("so_parsestring",str(so_ParseStringCount,0,0),".tmp");
     #fopen PARSEFILE Filename write
         #write(PARSEFILE,S)
     #fclose PARSEFILE
     #include Filename
     #declare so_ParseStringCount = so_ParseStringCount + 1;
#end
</POV>

I just thought I'd post this workaround in case somebody else is having 
similar problems. Perhaps I'd would be a good idea to add a note to the 
documentation, too, saying that you can't use it to create multiple 
macros on the fly.

BTW: Seems one can't live without Parse_String when it comes to create 
stuff in POV for which the SDL was not made/intended. I love it :)

Happy POVing,
Florian


Post a reply to this message

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