POV-Ray : Newsgroups : povray.general : The Language of POV-Ray : Re: The Language of POV-Ray Server Time
11 Aug 2024 09:20:51 EDT (-0400)
  Re: The Language of POV-Ray  
From: Chris Huff
Date: 12 Mar 2000 13:30:25
Message: <chrishuff_99-65AEA8.13321512032000@news.povray.org>
In article <38cbd2ee@news.povray.org>, Nieminen Juha 
<war### [at] sarakerttunencstutfi> wrote:

>   It's obvious that if the #break just jumps out of the #if-statement, it
> will be mostly useless.
> 
>   Unless...
>   ... you could specify how many blocks do the #break jump out of. For
> example:
...
>   Supposing that the #break also jumps out of the current 
>   #if-statement (and it's counted as one block), the #break in this 
>   code will jump to the line after the second last #end (ie. the line 
>   after the #while(cond2)-block, marked with "...").
> 
>   Of course a simple #break that just jumps out of the current loop would 
> be mostly enough.

Yes, that would be enough for just about anything. I guess I was 
thinking about Java-style multi-level breaks when I mentioned #if 
statements. I don't think they would really be needed in POV, but they 
might be a possibility in CSDL.


> : Maybe even macros(have you ever wanted to jump 
> : out of a macro early?)
> 
>   I don't know how this could be done. As far as I know, #macro is just
> a text-replacement command. The macro call is just replaced with the body
> of the macro with the parameters changed to their proper values.
>   If you would #break a macro, it would mean that the body will literally 
> be broken, ie. with missing #end-statements (probably from the #if 
> inside which the #break was) thus causing problems to the parser.

Wouldn't this problem with missing #end statements also occur with a 
loop? In both cases, there would probably be data in the parser that has 
to be reset.


>   If macros were more like function calls, it would be more easier to add
> a #return-statement.
> 
>   Now, that's an idea:
> 
> #function Abs(x)
>   #if(x>=0)
>     #return x
>   #else
>     #return -x
>   #end
> #end
> 
>   Hmm... Does this make sense? :)

I do like this better, since it works more like a function. But I am 
sure some people would consider it a needless complexity...maybe for 
CSDL though. :-)

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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