POV-Ray : Newsgroups : povray.general : macro limitation, why? Server Time
7 Aug 2024 11:16:39 EDT (-0400)
  macro limitation, why? (Message 1 to 5 of 5)  
From: Micha Riser
Subject: macro limitation, why?
Date: 26 Sep 2001 12:25:00
Message: <4evso9.0s3.ln@micha.riser>
Why does following not parse in POV (3.1):

----------------------
#macro return1()
        #if (1=1)
         1
        #end    
#end

#declare one=return1()
#debug "done\n\n\n"

#if (return1()=1)
        #debug "done."
#end
----------------------

... gives " xxx.pov:3: error: ) expected but # found instead. "

I could not find anything in the docs saying that this is not possible. Is 
it working in 3.5beta?

- Micha


Post a reply to this message

From:
Subject: Re: macro limitation, why?
Date: 26 Sep 2001 12:36:16
Message: <0r04rt48gas14781mq454r6vq4jbh699ua@4ax.com>
On Wed, 26 Sep 2001 18:23:32 +0200, Micha Riser <mri### [at] gmxnet>
wrote:

> Is it working in 3.5beta?

no

and I found shortest code for investigate bug

#if(#if(yes)yes#end)#end

I looks like bug with "if" inside "if"

I will report it to povray.beta-test but I'm sure THEY saw this

ABX


Post a reply to this message

From: Lutz-Peter Hooge
Subject: Re: macro limitation, why?
Date: 26 Sep 2001 13:53:09
Message: <MPG.161c34c391e7587998968c@news.povray.org>
In article <4ev### [at] michariser>, mri### [at] gmxnet says...
> #macro return1()
>         #if (1=1)
>          1
>         #end    
> #end

This is the problem I guess. It doesn't work this way, I don't know why, 
probably a bug.

Do it like this and it should work (at least in MP and 3.5):

#macro return1()
	#if(1=1)
		#local out=1;
	#else // just for the case 1 doesn't equal 1 *g*
		#local out=0; 
	#end
	out
#end

Lutz-Peter


Post a reply to this message

From: Chris Colefax
Subject: Re: macro limitation, why?
Date: 27 Sep 2001 07:45:46
Message: <3bb3116a@news.povray.org>
Micha Riser <mri### [at] gmxnet> wrote:
> Why does following not parse in POV (3.1):
[snip]
> ... gives " xxx.pov:3: error: ) expected but # found instead. "
>
> I could not find anything in the docs saying that this is not possible. Is
> it working in 3.5beta?

Try enclosing your calls to the macro in brackets, i.e:

#declare one=(return1());
#debug "done\n\n\n"

#if ((return1())=1)
        #debug "done."
#end

This should allow POV-Ray to correctly interpret the returned value, and
things should work as expected.


Post a reply to this message

From: Micha Riser
Subject: Re: macro limitation, why?
Date: 27 Sep 2001 08:35:02
Message: <9b6vo9.n83.ln@micha.riser>
Chris Colefax wrote:

> 
> Try enclosing your calls to the macro in brackets, i.e:
> 
> #declare one=(return1());
> #debug "done\n\n\n"
> 
> #if ((return1())=1)
>         #debug "done."
> #end
> 
> This should allow POV-Ray to correctly interpret the returned value, and
> things should work as expected.

Thanks, this works! It is a bit nicer than the workaround with an extra 
variable.

- Micha


Post a reply to this message

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