POV-Ray : Newsgroups : povray.general : Macros in 3.1 (not a bug report!) : Re: Macros in 3.1 (not a bug report!) Server Time
13 Aug 2024 17:22:36 EDT (-0400)
  Re: Macros in 3.1 (not a bug report!)  
From: Nathan O'Brien
Date: 18 Jul 1998 01:13:46
Message: <35B01F61.EE0DCB6@no13.net>
Alan Grainger wrote:
> 
> How do you exit from a macro?  For instance, you have called a macro, and a
> certain condition is reached, and you want the macro to exit.  How?
> 
> #macro DoMacro ( a, b, c )
>     blah blah...
>     #if ( something = true )
>         #endmacro
>     #end
>     more junk...
> #end
> 
> Also, is there any way to goto somewhere?
> 
> #macro DoMacro ( a, b, c )
>     blah blah...
> here:
>     blah blah...
>     #if ( something = true )
>         #goto here
>     #end
>     more stuff...
> #end
> 
> Thanks for any help.  :)

The easiest way I know of doing the first is placing the code inside a
#while loop with a simple switch. say

#macro DoMacro ( etc )
	#local Switch = 0;
	#while (Switch = 0)
		#if ( something = true )
			#local Switch = 1;
		#end
	#end
#end

As for the second, again placing sitches for various sections means that
instead of a literal goto, segments of the macro will be skipped. And if
you want to go backwards, intead of forwards, maybe the goto location
should be another macro in its own right. 

-- 
regards

Nathan O'Brien
no1### [at] no13net
http://www.no13.net


Post a reply to this message

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