 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
platform: POV35b6 on PII233 128 MB with NT4 SP6
I hope it is not a limitation like #if inside #if
two-line script
#declare A#declare A=0;=1;
#warning str(A,0,0)
prints 1 and I expected it
but script
#declare A=#declare A=0;1;
#warning str(A,0,0)
prints 0 but I expected 1
but what is most strange when I joined both
#declare A#declare A=0;=1;
#warning str(A,0,0)
#declare A=#declare A=0;1;
#warning str(A,0,0)
it twice prints 1
but when I changed it to (replaced second A with B)
#declare A#declare A=0;=1;
#warning str(A,0,0)
#declare B=#declare B=0;1;
#warning str(B,0,0)
it prints 0 and 1
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <1nbitto64ipgqujonpn6m6r7097rsol9ec@4ax.com> , W„odzimierz ABX
Skiba <abx### [at] babilon org> wrote:
> I hope it is not a limitation like #if inside #if
>
> two-line script
> #declare A#declare A=0;=1;
> #warning str(A,0,0)
> prints 1 and I expected it
> but script
> #declare A=#declare A=0;1;
> #warning str(A,0,0)
> prints 0 but I expected 1
> but what is most strange when I joined both
> #declare A#declare A=0;=1;
> #warning str(A,0,0)
> #declare A=#declare A=0;1;
> #warning str(A,0,0)
> it twice prints 1
> but when I changed it to (replaced second A with B)
> #declare A#declare A=0;=1;
> #warning str(A,0,0)
> #declare B=#declare B=0;1;
> #warning str(B,0,0)
> it prints 0 and 1
While I agree that the behavior is confusing, for versions up to and
including 3.5 and any 3.x version or bug fix release that may follow, assume
the behavior of nesting directives inside other directives is not specified.
So the answer is: Don't use it (also the parser allows it) because the
behavior is unlikely to be made consistent before a rewrite of POV-Ray.
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 12:20:37 +0200, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> So the answer is: Don't use it (also the parser allows it) because the
> behavior is unlikely to be made consistent before a rewrite of POV-Ray.
While I can get such answer, shouldn't be such sentence builded into
documentation instead of "directives can appear in almost any place in
the scene file - even in the middle of some other statements". You
wrote "the behavior of nesting directives inside other directives is
not specified". What about #macro inside #macro? #switch inside
#switch? Or mixing: #local inside #macro? This subject should be IMO
described little more within documentation.
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 12:20:37 +0200, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> So the answer is: Don't use it (also the parser allows it) because the
> behavior is unlikely to be made consistent before a rewrite of POV-Ray.
Is this the same thing ?
#local A=array#local C=1;#while(C<=5)[C]#local C=C+1;#end
personally I prefer post such things to warn people it not work
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <dueitto7imgspv5ojmn81htn9pvbof35v0@4ax.com> , W„odzimierz ABX
Skiba <abx### [at] babilon org> wrote:
> While I can get such answer, shouldn't be such sentence builded into
> documentation instead of "directives can appear in almost any place in
> the scene file - even in the middle of some other statements". You
> wrote "the behavior of nesting directives inside other directives is
> not specified". What about #macro inside #macro? #switch inside
> #switch? Or mixing: #local inside #macro? This subject should be IMO
> described little more within documentation.
You misunderstood what I mean with nesting. Think about it and it should be
obvious what is meant with nesting based on your examples.
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <0qjittsg3bmv8422pj5egqvo8p4sg9p36h@4ax.com> , W„odzimierz ABX
Skiba <abx### [at] babilon org> wrote:
> Is this the same thing ?
>
> #local A=array#local C=1;#while(C<=5)[C]#local C=C+1;#end
>
> personally I prefer post such things to warn people it not work
I would not recommend the above as it isn't disallowed. Use a macro and
call it, that will always work as you expect.
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 15:07:05 +0200, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> You misunderstood what I mean with nesting.
Perhaps.
> Think about it and it should be
> obvious what is meant with nesting based on your examples.
I just want to say it's good idea to add not working statements to
documentation and write something about this problem.
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 15:09:14 +0200, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> > Is this the same thing ?
> >
> > #local A=array#local C=1;#while(C<=5)[C]#local C=C+1;#end
> >
> > personally I prefer post such things to warn people it not work
>
> I would not recommend the above as it isn't disallowed. Use a macro and
> call it, that will always work as you expect.
like this ?
#macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
#local A=B()
it still not work with beta 6
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 15:21:31 +0200, W�odzimierz ABX Skiba
<abx### [at] babilon org> wrote:
> #macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
> #local A=B()
>
> it still not work with beta 6
but this works fine
#local A=array[#local C=1;#while(C<=4)C][#local C=C+1;#end 5]
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 15:21:31 +0200, W�odzimierz ABX Skiba
<abx### [at] babilon org> wrote:
> #macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
> #local A=B()
>
> it still not work with beta 6
it is probably connected with next thread
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <lloittsoa1lusa6n1of9epl8or51rt8s6e@4ax.com> , W„odzimierz ABX
Skiba <abx### [at] babilon org> wrote:
> #macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
> #local A=B()
>
> it still not work with beta 6
Move the "array" out of the macro perhaps? Or have the whole declare in the
macro?
____________________________________________________
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> What about #macro inside #macro? #switch inside
> #switch? Or mixing: #local inside #macro?
There's a difference between something like
#declare A#declare A=0;=1;
and something like
#switch (Something)
...
#switch (SomethingElse)
...
#end
...
#end
In the first case, the second #declare is actually *inside* the first
#declare. In the second case, the second switch is *between* the first
#switch and the first #end. (I know that's also commonly called "inside" but
it's a different kind of "inside".)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 15:48:02 +0200, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> > #macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
> > #local A=B()
> >
> > it still not work with beta 6
>
> Move the "array" out of the macro perhaps?
No. It not work and cursor is wrongly positioned inside line when
showing error.
> Or have the whole declare in the
> macro?
The same error: Expected 'object or directive'.
And the same thing appear when I call elements of declared array. This
not work:
#local A=array[1][1][1][1][1]{{{{{0}}}}}
#local B=A #local C=1;#while(C<=5)[0]#local C=C+1;#end
Do you agree it should works ? I ask becouse it could shorten a lot my
macros for arrays.inc requested by Rune.
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 09:57:07 -0400, "Anders K." <and### [at] f2s com>
wrote:
> > What about #macro inside #macro? #switch inside
> > #switch? Or mixing: #local inside #macro?
>
> There's a difference between something like ...
yes, but I thought about different inside than you :-)
look at below syntax and try answer how many "1" should be printed out
?
#macro Go(Level)
#debug "1\n"
#switch (Level>0?Go(Level-1):0)
#case(0) 1 #break
#end
#end
#local A=Go(1);
it produces 98 lines of "1" and error "to many nested symbol tables".
why ?
perhaps it is not the same bug but ...
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <joqitt063eivvf17ilrcc5ebbhmecq37fg@4ax.com> , W„odzimierz ABX
Skiba <abx### [at] babilon org> wrote:
> #local A=array[1][1][1][1][1]{{{{{0}}}}}
> #local B=A #local C=1;#while(C<=5)[0]#local C=C+1;#end
>
> Do you agree it should works ? I ask becouse it could shorten a lot my
> macros for arrays.inc requested by Rune.
Well, it doesn't really matter is it should work - as pointed out earlier, I
don't think it is going to change in 3.5. Only if it worked in 3.1 I would
say it should work in 3.5.
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> #macro Go(Level)
> #debug "1\n"
> #switch (Level>0?Go(Level-1):0)
> #case(0) 1 #break
> #end
> #end
The problem here is that Go(Level - 1) is *always* evaluated, whether Level
> 0 or not, because POV-Ray doesn't use short-circuit evaluation.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 16:25:48 +0200, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> Well, it doesn't really matter is it should work - as pointed out earlier, I
> don't think it is going to change in 3.5. Only if it worked in 3.1 I would
> say it should work in 3.5.
Could anybody check this ? I have 3.1 uninstalled.
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 10:38:59 -0400, "Anders K." <and### [at] f2s com>
wrote:
> > #macro Go(Level)
> > #debug "1\n"
> > #switch (Level>0?Go(Level-1):0)
> > #case(0) 1 #break
> > #end
> > #end
>
> The problem here is that Go(Level - 1) is *always* evaluated, whether Level
> 0 or not, because POV-Ray doesn't use short-circuit evaluation.
yes, right, I missed this.
but how it should looks with #if ?
it seems not work too.
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> > > #macro Go(Level)
> > > #debug "1\n"
> > > #switch (Level>0?Go(Level-1):0)
> > > #case(0) 1 #break
> > > #end
> > > #end
> >
> > The problem here is that Go(Level - 1) is *always* evaluated, whether
Level
> > 0 or not, because POV-Ray doesn't use short-circuit evaluation.
>
> yes, right, I missed this.
> but how it should looks with #if ?
> it seems not work too.
Well, there's also another problem: if the result of the #switch statement
isn't 0, the macro doesn't return anything, which causes errors. I'm not
sure what you meant to write, but this is definately not a bug in POV-Ray.
Anders
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"W³odzimierz ABX Skiba" wrote:
>
> On Fri, 26 Oct 2001 15:21:31 +0200, W³odzimierz ABX Skiba
> <abx### [at] babilon org> wrote:
> > #macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
> > #local A=B()
> >
> > it still not work with beta 6
>
> but this works fine
>
> #local A=array[#local C=1;#while(C<=4)C][#local C=C+1;#end 5]
Are you REALLY sure that it is necessary
to EVER write such ugly lines of code ???
Tor Olav
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Sat, 27 Oct 2001 04:38:10 +0200, Tor Olav Kristensen
<tor### [at] hotmail com> wrote:
> "W?odzimierz ABX Skiba" wrote:
> >
> > On Fri, 26 Oct 2001 15:21:31 +0200, W?odzimierz ABX Skiba
> > <abx### [at] babilon org> wrote:
> > > #macro B() array#local C=1;#while(C<=5)[C]#local C=C+1;#end #end
> > > #local A=B()
> > >
> > > it still not work with beta 6
> >
> > but this works fine
> >
> > #local A=array[#local C=1;#while(C<=4)C][#local C=C+1;#end 5]
>
> Are you REALLY sure that it is necessary
> to EVER write such ugly lines of code ???
working line is ugly but not working line is pretty usefull
I found it not by playing but working on useful macro
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 26 Oct 2001 11:29:44 -0400, "Anders K." <and### [at] f2s com>
wrote:
> Well, there's also another problem: if the result of the #switch statement
> isn't 0, the macro doesn't return anything, which causes errors. I'm not
> sure what you meant to write, but this is definately not a bug in POV-Ray.
yes, this "fight" made me mad and I've made mistake, sorry
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |