POV-Ray : Newsgroups : povray.general : Undefine macro? Server Time
7 Aug 2024 05:16:27 EDT (-0400)
  Undefine macro? (Message 11 to 20 of 21)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 1 Messages >>>
From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:45:39
Message: <3c10e423@news.povray.org>
"N Shomber" wrote:
> Have you tried #undef ???

My whole point is that #undef doesn't work with macros and that's what I
don't like.

> If that doesn't work, perhaps you could redefine it
> after it is called based on a flag set within the macro?

I don't want to redefine it! I want to undefine it!

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:45:45
Message: <3c10e429@news.povray.org>
"Trevor Quayle" wrote:
> Just thinking, if this is the case perhaps you could
> do something like:

That only works when the code invoking the macro expects a string, which it
doesn't.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:45:46
Message: <3c10e42a@news.povray.org>
"Trevor Quayle" wrote:
> This may not be what rune is looking for, if  I understand
> correctly.  If you do this, you may end up getting an
> error when you try to use the macro.

Exactly.

> If you could undefine it, then you could check if it is
> defined, and only run it if it was.

Yes. And much other code will also only be run if the macro is defined.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:45:47
Message: <3c10e42b@news.povray.org>

> Could it be good workaround for you ?

Sorry, too slow, as the macro will be called 10000, 100000 or more times.

Besides, the macro is to be defined by the *user* of my include file, so
simplicity is vital.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:45:48
Message: <3c10e42c@news.povray.org>
"Ron Parker" wrote:
> Can you just redefine it to do nothing?

No! I want to undefine it!

I use #ifdef to test whether or not the macro is defined, and of course it
still returns true if I redefine the macro to do nothing.

You can define a macro and you can test whether or not it's defined, but you
can't undefine it. I find that highly inconsistent! Is there any reasoning
behind this design in POV-Ray?

If not, I hope that the ability to undefine a macro using #undef will be
added to POV-Ray ASAP.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:45:49
Message: <3c10e42d$1@news.povray.org>
"Mark Wagner" wrote:
> You should be able to "undefine" a macro by
> redefining it as something like:

That's not undefining the macro. #ifdef is the proof, and also the reason
it's not a working solution for me.

See my reply to Ron.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From:
Subject: Re: Undefine macro?
Date: 7 Dec 2001 10:55:32
Message: <g8p11u41ah88kc5078uk8m61b23jgumjb1@4ax.com>
On Fri, 7 Dec 2001 16:41:58 +0100, "Rune" <run### [at] mobilixnetdk> wrote:
> Besides, the macro is to be defined by the *user* of my include file, so
> simplicity is vital.

Is it some kind of method/properities of the particle ?
Can you list this methods ?
Can you build array of arrays of methods ?
#if(Defined_Method(ParticleID,Method_Selector)) ?
So user have to write macro with method and define entry in array of methods?
Of course it is workaround not as good as it could be.

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

From: Ron Parker
Subject: Re: Undefine macro?
Date: 7 Dec 2001 11:13:06
Message: <slrna11qkk.nq1.ron.parker@fwi.com>
On Fri, 7 Dec 2001 16:43:56 +0100, Rune wrote:
> "Ron Parker" wrote:
>> Can you just redefine it to do nothing?
> 
> No! I want to undefine it!
> 
> I use #ifdef to test whether or not the macro is defined, and of course it
> still returns true if I redefine the macro to do nothing.
> 
> You can define a macro and you can test whether or not it's defined, but you
> can't undefine it. I find that highly inconsistent! Is there any reasoning
> behind this design in POV-Ray?
> 
> If not, I hope that the ability to undefine a macro using #undef will be
> added to POV-Ray ASAP.

The ability to do so was mostly already there, but there was a bug that
prevented it from working.  When we saw the macro ID, we tried to invoke
the macro instead of just looking at its ID.  That bug will be fixed in
the next beta of 3.5.

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 13:42:31
Message: <3c110d97@news.povray.org>
"Ron Parker" wrote:
> The ability to do so was mostly already there, but
> there was a bug that prevented it from working.
> When we saw the macro ID, we tried to invoke the
> macro instead of just looking at its ID.  That bug
> will be fixed in the next beta of 3.5.

Just what I hoped for! Many thanks!

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Undefine macro?
Date: 7 Dec 2001 13:42:35
Message: <3c110d9b$1@news.povray.org>

> Of course it is workaround not as good as it could be.

Never mind, Ron have said that the problem will be fixed in the next beta.
:)

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Nov 5)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 1 Messages >>>

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