POV-Ray : Newsgroups : povray.beta-test : ; or no ; ? Server Time
30 Jul 2024 16:13:11 EDT (-0400)
  ; or no ; ? (Message 1 to 3 of 3)  
From: Elias Pschernig
Subject: ; or no ; ?
Date: 27 Oct 2001 20:18:01
Message: <3bdb4eb9@news.povray.org>
Some more parser weirdness in the following test scene (sorry if known):

#macro POS(X) #if (X > 0)  1  #else  0  #end #end
                
#local Y = POS(5)

It works fine, but issues a warning about a missing semicolon. If I add the
semicolon after the POS(5), it still complains, but also gives an error.

(3.5.beta.6 win32 (.icl), winME, P3, 933MHz, 384MB)

-- 
#macro C(X,Y)cylinder{X*x<X,0,-Y/2>.1}#end#macro U(R,X,Y)intersection{torus{.9
.1}box{-1 0rotate y*R*90}translate<X,0,Y>scale 1-z*.5}#end union{U(0,0,0)U(1,0
,0)U(2,-1,-1)U(1,1,0)U(1,1.5,-3)U(1,2,0)U(3,1,0)U(2,2,0)U(0,3,0)U(3,2,.5)C(.1,
2)C(.8,1)C(.8,-1)C(1.1,1)C(1.9,-1)pigment{rgb 10}rotate x*90translate<-1,0,4>}


Post a reply to this message

From: Jan Walzer
Subject: Re: ; or no ; ?
Date: 28 Oct 2001 10:43:38
Message: <3bdc27aa@news.povray.org>
and if you add some "(" and ")" ???
either in the macro itself, before the "#if" and after the first "#end"
or around the "POS(5)" ...

I for myself try to include such macros always in parentheses to avoid
side-effects... maybe this is one to the parser ...

--
Jan Walzer <jan### [at] lzernet>
"Elias Pschernig" <eli### [at] aonat> schrieb im Newsbeitrag
news:3bdb4eb9@news.povray.org...
> Some more parser weirdness in the following test scene (sorry if known):
>
> #macro POS(X) #if (X > 0)  1  #else  0  #end #end
>
> #local Y = POS(5)
>
> It works fine, but issues a warning about a missing semicolon. If I add the
> semicolon after the POS(5), it still complains, but also gives an error.
>
> (3.5.beta.6 win32 (.icl), winME, P3, 933MHz, 384MB)
>
> --
> #macro C(X,Y)cylinder{X*x<X,0,-Y/2>.1}#end#macro
U(R,X,Y)intersection{torus{.9
> .1}box{-1 0rotate y*R*90}translate<X,0,Y>scale 1-z*.5}#end
union{U(0,0,0)U(1,0
>
,0)U(2,-1,-1)U(1,1,0)U(1,1.5,-3)U(1,2,0)U(3,1,0)U(2,2,0)U(0,3,0)U(3,2,.5)C(.1
,
> 2)C(.8,1)C(.8,-1)C(1.1,1)C(1.9,-1)pigment{rgb 10}rotate
x*90translate<-1,0,4>}
>


Post a reply to this message

From: Elias Pschernig
Subject: Re: ; or no ; ?
Date: 28 Oct 2001 11:01:26
Message: <3bdc2bd6$1@news.povray.org>
> and if you add some "(" and ")" ???
> either in the macro itself, before the "#if" and after the first "#end"
> or around the "POS(5)" ...
> 
> I for myself try to include such macros always in parentheses to avoid
> side-effects... maybe this is one to the parser ...
> 

Yes, I discovered that shortly after. But in a more complex example, this
wouldn't be so obvious. The current behaviour is at least confusing :) I hope
there will be some change to the parser, so it either gets more strict in what
it accepts, or everything accepted also gets handled correctly..

-- 
#macro C(X,Y)cylinder{X*x<X,0,-Y/2>.1}#end#macro U(R,X,Y)intersection{torus{.9
.1}box{-1 0rotate y*R*90}translate<X,0,Y>scale 1-z*.5}#end union{U(0,0,0)U(1,0
,0)U(2,-1,-1)U(1,1,0)U(1,1.5,-3)U(1,2,0)U(3,1,0)U(2,2,0)U(0,3,0)U(3,2,.5)C(.1,
2)C(.8,1)C(.8,-1)C(1.1,1)C(1.9,-1)pigment{rgb 10}rotate x*90translate<-1,0,4>}


Post a reply to this message

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