POV-Ray : Newsgroups : povray.general : Undefine macro? Server Time
20 Nov 2024 02:30:34 EST (-0500)
  Undefine macro? (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Rune
Subject: Undefine macro?
Date: 6 Dec 2001 09:26:06
Message: <3c0f7ffe@news.povray.org>
I really need to be able to undefine macros, but it doesn't seem to be
possible...?

I find it strange, as it's possible to overwrite a macro, just like
variables, and to check if a macro is defined using #ifdef, just like
variables, but to undefine it isn't possible for some reason (or is 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: Trevor Quayle
Subject: Re: Undefine macro?
Date: 6 Dec 2001 09:44:18
Message: <3c0f8442$1@news.povray.org>
Why do you need to undefine it?
Not trying to be confrontational, it may help to find a solution.

-tgq

"Rune" <run### [at] mobilixnetdk> wrote in message
news:3c0f7ffe@news.povray.org...
> I really need to be able to undefine macros, but it doesn't seem to be
> possible...?
>
> I find it strange, as it's possible to overwrite a macro, just like
> variables, and to check if a macro is defined using #ifdef, just like
> variables, but to undefine it isn't possible for some reason (or is 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: 6 Dec 2001 13:04:20
Message: <3c0fb324@news.povray.org>
"Trevor Quayle" wrote:
> Why do you need to undefine it?

In my particle system many settings are specified with macros rather than
with variables. The particle system can be called more than once in the same
scene, and sometimes you want some settings to be specified the first time
the system is called, but not the second time.

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: N Shomber
Subject: Re: Undefine macro?
Date: 6 Dec 2001 22:08:10
Message: <3c10329a@news.povray.org>
> I find it strange, as it's possible to overwrite a macro, just like
> variables, and to check if a macro is defined using #ifdef, just like
> variables, but to undefine it isn't possible for some reason (or is it?).

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

N Shomber


Post a reply to this message

From: Ron Parker
Subject: Re: Undefine macro?
Date: 6 Dec 2001 23:36:15
Message: <slrna10hq6.kpj.ron.parker@fwi.com>
On Thu, 6 Dec 2001 19:12:01 -0800, N Shomber wrote:
>> I find it strange, as it's possible to overwrite a macro, just like
>> variables, and to check if a macro is defined using #ifdef, just like
>> variables, but to undefine it isn't possible for some reason (or is it?).
> 
> Have you tried #undef ???
> If that doesn't work, perhaps you could redefine it after it is called
> based on a flag set within the macro?

Can you just redefine it to do nothing?

-- 
#local R=<7084844682857967,0787982,826975826580>;#macro L(P)concat(#while(P)chr(
mod(P,100)),#local P=P/100;#end"")#end background{rgb 1}text{ttf L(R.x)L(R.y)0,0
translate<-.8,0,-1>}text{ttf L(R.x)L(R.z)0,0translate<-1.6,-.75,-1>}sphere{z/9e3
4/26/2001finish{reflection 1}}//ron.parker@povray.org My opinions, nobody else's


Post a reply to this message

From: Mark Wagner
Subject: Re: Undefine macro?
Date: 7 Dec 2001 03:33:56
Message: <3c107ef4@news.povray.org>
Rune wrote in message <3c0f7ffe@news.povray.org>...
>I really need to be able to undefine macros, but it doesn't seem to be
>possible...?


You should be able to "undefine" a macro by redefining it as something like:

#macro mymacro(a,b,c)
  /* A macro that does nothing */
#end

--
Mark


Post a reply to this message

From: s1631001
Subject: Re: Undefine macro?
Date: 7 Dec 2001 04:34:48
Message: <3C108A14.18681430@namtar.qub.ac.uk>
Rune wrote:
> In my particle system many settings are specified with macros rather than
> with variables. The particle system can be called more than once in the same
> scene, and sometimes you want some settings to be specified the first time
> the system is called, but not the second time.

From this I assume Rune means that his system checks whether or not the
macro is defined (using #ifdef), else it assigns a default value;
redefining the macro to do nothing wouldn't be any use here.

-- 
signature{
  "Grey Knight"
  contact{ email "gre### [at] yahoocom" }
  site_of_week{ url "http://www.esite-host.com/~rocketmg/" }
}


Post a reply to this message

From: Trevor Quayle
Subject: Re: Undefine macro?
Date: 7 Dec 2001 07:33:41
Message: <3c10b725$1@news.povray.org>
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.
If you could undefine it, then you could check if it is defined, and only
run it if it was.
Or perhaps I'm just putting words in your mouth.

-tgq

"Mark Wagner" <mar### [at] gtenet> wrote in message
news:3c107ef4@news.povray.org...
>
> Rune wrote in message <3c0f7ffe@news.povray.org>...
> >I really need to be able to undefine macros, but it doesn't seem to be
> >possible...?
>
>
> You should be able to "undefine" a macro by redefining it as something
like:
>
> #macro mymacro(a,b,c)
>   /* A macro that does nothing */
> #end
>
> --
> Mark
>
>


Post a reply to this message

From: Trevor Quayle
Subject: Re: Undefine macro?
Date: 7 Dec 2001 07:37:49
Message: <3c10b81d$1@news.povray.org>
"Trevor Quayle" <Tin### [at] hotmailcom> wrote in message
news:3c10b725$1@news.povray.org...
> 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.
> If you could undefine it, then you could check if it is defined, and only
> run it if it was.
> Or perhaps I'm just putting words in your mouth.
>
> -tgq
>

Just thinking, if this is the case perhaps you could do something like:

#macro MyMacro(a,b,c)
    "XXX"
#end

then check using:

#if(MyMacro(a,b,c) != "XXX")
#end


-tgq


Post a reply to this message

From:
Subject: Re: Undefine macro?
Date: 7 Dec 2001 07:44:41
Message: <fvd11uobje6lksrem9uvv32761em5l6pf8@4ax.com>
On Thu, 6 Dec 2001 15:24:59 +0100, "Rune" <run### [at] mobilixnetdk> wrote:
> I really need to be able to undefine macros, but it doesn't seem to be
> possible...?

Could it be good workaround for you ?

#version 3.5;
#include "strings.inc"
#macro Define_Macro(Name)
  Parse_String(concat("#declare Macro_",Name,"_Defined=yes"))
#end
#macro Undefine_Macro(Name)
  Parse_String(concat("#undef Macro_",Name,"_Defined"))
#end
#macro Is_Macro_Defined(Name)
  Parse_String(concat("(defined(Macro_",Name,"_Defined)"))
#end

I have not tested this becouse of "Instances" problem of current beta, 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

Goto Latest 10 Messages Next 10 Messages >>>

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