POV-Ray : Newsgroups : povray.newusers : if inside a macro syntax (if...else) : Re: if inside a macro syntax (if...else) Server Time
30 Jul 2024 00:23:28 EDT (-0400)
  Re: if inside a macro syntax (if...else)  
From: kurtz le pirate
Date: 30 Dec 2004 09:56:39
Message: <kurtzlepirate-2D5B3C.15563830122004@news.povray.org>
In article <Xns95CF3BB3DD30Araf256com@203.29.75.35>,
 "Rafal 'Raf256' Maj" <spa### [at] raf256com> wrote:

>>Hi,
>>syntax like
>>
>>#local size = big ? 100 : 50;
>>
>>(from C "operator?" ) isnt working, and writting it normaly as:
>>
>>#if (big) #local size=100; #else #local size=50; #end
>>
>>is quite long (I like to keep my syntax short). So I wanted to write a tiny 
>>IfElse function, like:
>>
>>#macro IfElse(A,B,C) #if (A) 55 #else 30 #end #end
>>
>>#local DD = IfElse(variant_Wide, 50, 100);
>>
>>but it gaves a pares error.
>>
>>I replaced it with good sytnax:
>>  #macro IfElse(A,B,C) select(A-1,C,B,C) #end
>>that do work, but just for curiosity, how to make previous syntax work 
>>also?

hi,

 - "size" is a reserved keyword from pov.
 - "c" like comparaison works as this : #local mySize=(bib?100:50);
 - macro in pov is not the same as macro in c. there is no "code 
substitution".
 - you ca write : #macro IfElse(A,B,C) (A?B:C) #end ... but it's more 
long that the direct pov sdl (A?B:C) syntax form.


Post a reply to this message

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