POV-Ray : Newsgroups : povray.general : Macro Initialization? Server Time
10 Aug 2024 09:16:52 EDT (-0400)
  Macro Initialization? (Message 1 to 10 of 27)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Bill DeWitt
Subject: Macro Initialization?
Date: 10 Feb 2000 08:20:30
Message: <38a2bb1e@news.povray.org>
I want to use macros in a way that they probably can't be used. I only ask
because every time I don't, it turns out that what I want to do is quite
easy and everyone but me has been doing it all along...

I want to call the macro with only those values that are relevant to it's
present use. For instance...

gadget(knobs)
gadget(knobs,lights,dials)
gadget(dials,dial_light,dial_needle,dial_range)

    ... where everything not specified is assumed. This is because I want to
make some macros with a couple dozen possible fields and I don't want to
have to list every one of them every time.

    TIA


Post a reply to this message

From: Ron Parker
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 08:25:59
Message: <slrn8a5f37.v8.ron.parker@ron.gwmicro.com>
On Thu, 10 Feb 2000 08:20:31 -0500, Bill DeWitt wrote:
>I want to use macros in a way that they probably can't be used. I only ask
>because every time I don't, it turns out that what I want to do is quite
>easy and everyone but me has been doing it all along...
>
>I want to call the macro with only those values that are relevant to it's
>present use. For instance...

While this has been discussed in the past, it's never been implemented, 
so you're safe from ridicule: it can't (yet) be done.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Bill DeWitt
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 08:44:25
Message: <38a2c0b9@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote :
>
> so you're safe from ridicule:
>

    Well, at least about this....


Post a reply to this message

From: Mikael Carneholm
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 09:41:18
Message: <38A2CE02.5145A6B7@ida.utb.hb.se>
Overloading functions (macros) is currently not possible. Maybe something to
implement in 3.5?

----------------------------------------------------
Mikael Carneholm
Dep. of Computer Science and Business Administration


Personal homage:
http://www.studenter.hb.se/~arch
E-mail:
sa9### [at] idautbhbse


Post a reply to this message

From: Philippe Debar
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 10:11:39
Message: <38a2d52b@news.povray.org>
"Bill DeWitt" <the### [at] earthlinknet> wrote in message
news:38a2bb1e@news.povray.org...
> I want to call the macro with only those values that are relevant to it's
> present use. For instance...
>
> gadget(knobs)
> gadget(knobs,lights,dials)
> gadget(dials,dial_light,dial_needle,dial_range)
>
>     ... where everything not specified is assumed. This is because I want
to
> make some macros with a couple dozen possible fields and I don't want to
> have to list every one of them every time.
>
>     TIA


A workaround: *.inc files

with scripts like

#ifndef(gadgetKnobs) #declare gadgetKnobs=126; #end

at the beginning.

If there are really many settings, use *.inc files for storing settings
=>
#include "gadgetDefaultSettings 01.inc"
#declare gadgetKnob=1493;
#include "gadget.inc"


Hope this helps


Philippe


Post a reply to this message

From: Alex Wolff
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 13:26:28
Message: <38A302F5.8EF2B964@gmx.de>
Bill DeWitt wrote:

> I want to call the macro with only those values that are relevant to
> it's
> present use.

just like philippe still mentioned:use the ifndef-function. i think it
could be done without an *.inc-file like this:

// here you can declare only the params you need:
#declare par1=35;
#declare par2=3.7;
#declare par3=383;
// before calling the macro, all undefined params are checked and
// set to a default value:
#ifndef (par1) #declare par1=1.0; #end
#ifndef (par2) #declare par1=0.0; #end
#ifndef (par3) #declare par1=2.5; #end
.
.
// now, with all params declared, you can call your macro:
gadget (par1,par2,par3,...)

alex


Post a reply to this message

From: Peter Warren
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 13:35:30
Message: <38a304f2@news.povray.org>
Bill DeWitt wrote in message <38a2c0b9@news.povray.org>...
>
>"Ron Parker" <ron### [at] povrayorg> wrote :
>>
>> so you're safe from ridicule:
>>
>
>    Well, at least about this....
>
>

povray.general.dewitt.lol


Post a reply to this message

From: Chris Huff
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 16:31:17
Message: <chrishuff_99-A1E76B.16322010022000@news.povray.org>
In article <38A2CE02.5145A6B7@ida.utb.hb.se>, sa9### [at] idautbhbse 
wrote:

> Overloading functions (macros) is currently not possible. Maybe 
> something to implement in 3.5?

This sounds more like default values for parameters than 
overloading--although overloading might also be nice, I don't think it 
would be possible without changing the syntax for variables(which might 
not be such a bad idea).

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: David Fontaine
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 17:54:47
Message: <38A34160.CD6BD8CB@faricy.net>
Bill DeWitt wrote:

> "Ron Parker" <ron### [at] povrayorg> wrote :
> >
> > so you're safe from ridicule:
> >
>
>     Well, at least about this....

Bill DimWitt. (couldn't resist) :-)

--
___     ______________________________________________________
 | \     |_                 <dav### [at] faricynet> <ICQ 55354965>
 |_/avid |ontaine               http://www.faricy.net/~davidf/

"Sitting on a cornflake, waiting for the van to come" -Beatles


Post a reply to this message

From: Ron Parker
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 17:59:37
Message: <slrn8a6h5o.ov.ron.parker@linux.parkerr.fwi.com>
On Thu, 10 Feb 2000 16:53:20 -0600, David Fontaine wrote:
>Bill DeWitt wrote:
>>     Well, at least about this....
>
>Bill DimWitt. (couldn't resist) :-)

I've managed to resist all these years.  Surely you could have. :)


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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