POV-Ray : Newsgroups : povray.general : macro always returns zero : Re: macro always returns zero Server Time
5 May 2024 23:25:07 EDT (-0400)
  Re: macro always returns zero  
From: stevenvh
Date: 25 May 2017 11:25:00
Message: <web.5926f6e12c479cc1ddeb13060@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>
> Looks to me like your problem is somewhere else. Maybe a minimal
> self-contained scene file demonstrating the problem would help.

OK, so I stripped everything unnecessary for creating some output and saved it
as test.pov. What do you think? It works, of course :-(.
I then removed code line by line from my original file until it would work. By
the way, "work" means it doesn't go in an infinite parsing loop.
The code contains

#declare colorRnd1 = 0;
#declare colorRnd2 = 0;
#while ( colorRnd2 = colorRnd1 )
  #declare colorRnd1 = RandInt(4, Rnd3);
  #declare colorRnd2 = RandInt(4, Rnd3);
#end

and since RandInt always seems to return zero it never exits the while loop.

In the end I had a file which still didn't work and an identical-looking one
which did work. Since the problem seemed to be with the RandInt I scrutinized
the above lines. I compared them character by character (esp. the digits!). And
did so 5 (five) times. They were identical in both files.
If there was any difference it was not visible as ASCII text. So I copied the
above code from the working test.pov and pasted it in the other file.
Result: the latter also works.

I regret that I didn't compare the files with a hex editor. I believe there was
one or more erroneous characters in the file which confused the parser.
This happened to me before! A file which looked syntactically and semantically
OK caused parsing errors. After spending an eternity checking the syntax I
finally put the cursor some 40 or 50 characters after what should have been the
end of the line, and backspaced until the last non-blank character. Problem
solved.

I'm using the POVray for Windows editor component; possibly the cause of the
problem lies there. (I'm not very fond of PovClipse. Eclipse is written in Java,
and Java is infamous for being a huge security liability.)


Post a reply to this message

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