![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Christopher James Huff" wrote:
> If you wrap the conditional in parentheses, it will work fine
Yes, I use that trick all the time...
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Jan 2)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>On Mon, 07 Jan 2002 13:18:44 +0100, "Thorsten Froehlich" <tho### [at] trf de>
>wrote:
>> Semicolons are listed as required after every #local, #declare and #version
>> with a float, vector or color value. If you don't include the required
>> semicolon the problem is in your scene and the parser reports it as soon as
>> it is possible to report this.
>
>I think you misunderstand my report so I post shorter example:
>
>#macro Test2() #if(yes) 2 #end #end
>#local F=Test2();
>
>note: there is semicolon but parser expects object or directive
But POV macros behave as if they were *macros* not functions.
If POV macros behaved like *functions* then Test2() would return the
value "2". "2" is a float, so you'd expect a semicolon to be
permissible.
Since POV macros behave like *macros*, Test2() behaves as if it returns
the code "#if(yes) 2 #end".
So
#macro Test2() #if(yes) 2 #end #end
#local F=Test2();
behaves like the illegal statement
#local F=#if(yes) 2 #end;
Note that this is legal:
#macro Test2() (#if(yes) 2 #end) #end
#local F=Test2();
Because that behaves like the legal statement
#local F=(#if(yes) 2 #end);
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Mike Williams <mik### [at] nospam please> wrote:
: But POV macros behave as if they were *macros* not functions.
In fact, POV-Ray macros do not work like real substitution macros
(like the #defined macros in C).
This:
#macro A()
#local a = 5;
#end
#local a = 6;
A()
is *not* the same as:
#local a = 6;
#local a = 5;
I think that at low-level the difference between pov-macros and C-macros
is that in the latter the macro body is truely placed in the place of the
macro call by the pre-compiler (and then the actual compiler sees just this
but has no knowledge of the original macro), while in POV-Ray the macro is
parsed where it is, without making a real substitution. The difference is
very tenuous and most of the time it has no effect, but in some cases it
has (like when you use #local identifiers inside the macro).
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Mon, 7 Jan 2002 19:31:34 +0000, Mike Williams <mik### [at] nospam please> wrote:
> behaves like the illegal statement
> #local F=#if(yes) 2 #end;
I agree paranthesis are best workaround but IMO there is no place in
documentation where above is listed as illegal.
ABX
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
wrote:
> [..] IMO there is no place in
> documentation where above is listed as illegal.
I'll see what I can do about it.
Ingo
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8 Jan 2002 06:42:20 -0500, ingo <ing### [at] home nl> wrote:
> > [..] IMO there is no place in
> > documentation where above is listed as illegal.
>
> I'll see what I can do about it.
Wait for the team. Perhaps it is yet a bug.
ABX
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Skiba <abx### [at] babilon org> wrote:
> Wait for the team. Perhaps it is yet a bug.
No, if this worked the way in 3.1 it was by design hat only macros may
return data. I don't see a point in changing something that worked this way
before without problems, also it doesn't work as one would expect as a
programmer it is still deterministic and an easy rule for users.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 7 Jan 2002 09:00:15 -0500, Warp wrote:
>: #macro Test2() #if(yes) 2 #end #end
>: #local F=Test2();
>
> Isn't the "right way" of returning values from a macro something like:
>
> #macro Test2() #if(yes) #local res=2; #end res #end
Except for that minor detail of it causing crashes when you return a local.
--
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |