POV-Ray : Newsgroups : povray.general : Is this a bug? : Re: Is this a bug? : WORKAROUND Server Time
26 Jun 2024 01:21:19 EDT (-0400)
  Re: Is this a bug? : WORKAROUND  
From: Jaime Vives Piqueres
Date: 19 Jan 2016 03:58:48
Message: <569dfac8@news.povray.org>

> I have tried it in every possible way I can come up with and what I
> have found is that povray sometimes chokes on reading data while
> inside a #macro. Which indicates to me that povray does not handle
> #macros correctly. Another indicator to that is that shortly before
> it crashes the memory usage goes up strongly.

   Well, thanks to a recent question by Thomas about Parse_String(), if
you absolutely need to include code on a macro, there is a workaround
using that function from strings.inc:

   Write the include file like this:

#write(filehandle, "\"#declare CFS[",str(Count,0,0),"] = <", vstr(3,
CFS[Count], ", ", -1,-1),">;\",\n")

   Then, instead using #include "data.inc", use a call to this macro:

#macro ParseInclude(IncludeFile)
   #fopen filehandle IncludeFile read
   #while (defined(filehandle))
     #read (filehandle,IncludeLine)
     #debug IncludeLine
     #debug "\n"
     Parse_String(IncludeLine)
   #end
   #fclose filehandle
#end

   like this:

ParseInclude("data.inc")


   Hope this helps...

--
jaime


Post a reply to this message

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