| 
  | 
I would like to request that strings be allowed in switch statements. This is a
pretty common feature in programming languages, and I was kind of disappointed
that POV-Ray doesn't allow this. I like to use strings as configuration
settings, as they're more readable, and then use a switch statement to check
their values.
Thanks.
-Mike
 
 Post a reply to this message 
 | 
  | 
 | 
  | 
"SharkD" <nomail@nomail> wrote in message 
news:web.4862b25f88b3e5e9388aeae80@news.povray.org...
>I would like to request that strings be allowed in switch statements. This 
>is a
> pretty common feature in programming languages, and I was kind of 
> disappointed
> that POV-Ray doesn't allow this. I like to use strings as configuration
> settings, as they're more readable, and then use a switch statement to 
> check
> their values.
actually sounds like you would be better off defining some constants and 
using those:
---- start code UsefullMacros.inc ----
#declare SPHERE=1;
#declare CYLINDER=2;
#declare BOX=3;
#macro Shape(Type)
    #switch(Type)
        #case (SPHERE)
            sphere {0,1}
            #break
        #case (CYLINDER)
            cylinder {-y,y,1}
            #break
        #case (BOX)
            box {-1,1}
            #break
    #end
#end
---- end code UsefullMacros.inc ----
---- start code UsefullMacrosTest.pov ----
#include "UsefullMacros.inc"
Shape(SPHERE)
---- end code UsefullMacrosTest.pov ----
cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com
 Post a reply to this message 
 | 
  |