 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Why do you need to undefine it?
Not trying to be confrontational, it may help to find a solution.
-tgq
"Rune" <run### [at] mobilixnet dk> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] yahoo com" }
site_of_week{ url "http://www.esite-host.com/~rocketmg/" }
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] gte net> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Trevor Quayle" <Tin### [at] hotmail com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 6 Dec 2001 15:24:59 +0100, "Rune" <run### [at] mobilixnet dk> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"W³odzimierz ABX Skiba" wrote:
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 7 Dec 2001 16:41:58 +0100, "Rune" <run### [at] mobilixnet dk> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"W³odzimierz ABX Skiba" wrote:
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Rune" <run### [at] mobilixnet dk> wrote in message
news:3c110d9b$1@news.povray.org...
> "W³odzimierz ABX Skiba" wrote:
> > 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
Phew, I have been wracking my brain all day trying to figure this one out.
I have been released.
I did come up with some really odd stuff in the process though.
-tgq
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |