POV-Ray : Newsgroups : povray.general : Macro Initialization? Server Time
16 Oct 2026 21:37:25 EDT (-0400)
  Macro Initialization? (Message 1 to 27 of 27)  
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
UCB (University College of Borås) Sweden

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

From: Bill DeWitt
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 18:30:28
Message: <38a34a14@news.povray.org>
"David Fontaine" <dav### [at] faricynet> wrote :
>
> Bill DimWitt. (couldn't resist) :-)
>

    This is one of the most common ones. Here is the list of ones that have
caused their owners to sprout broken noses so far....

DimWitt (3)
DipShit (2)
DeTwitt (1)
DickLick (1)(which my spellchecker thinks should be picklock)
DeWittless (1)

    I once let a "BeShat" slide on account of originality and because he got
the past tense of "to shit" correct.


Post a reply to this message

From: Peter Popov
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 18:59:30
Message: <AFCjOLiE2pcJByPRUFOIBbzQ8y=7@4ax.com>
On Thu, 10 Feb 2000 18:30:21 -0500, "Bill DeWitt"
<the### [at] earthlinknet> wrote:

>    I once let a "BeShat" slide on account of originality and because he got
>the past tense of "to shit" correct.

Ahem, that past tense is a myth last that I cared to check. It follows
the conjugation of "sit" because they are somewhat related, but it
could as well have preferred the "fit" way. It's a made-up thing
afaik.


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Mark Gordon
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 20:40:30
Message: <38A36961.4FE3809@mailbag.com>
Peter Popov wrote:

> Ahem, that past tense is a myth last that I cared to check. It follows
> the conjugation of "sit" because they are somewhat related, but it
> could as well have preferred the "fit" way. It's a made-up thing
> afaik.

Since it derives from Old English, and most of the similar verbs derived
from Old English ("sit" and "spit") are strong verbs, it's entirely
logical that it follow the same pattern.  I don't have an OED, and none
of my Old English textbooks have the word, but I don't have the Old
English leechcraft book (the one place I'd expect it), so I'm not
entirely surprised I can't find it.  If I really, really wanted to, I
might be able to look it up at the friendly neighborhood reference
library.

-Mark Gordon


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 21:14:10
Message: <38a37072@news.povray.org>
In article <chrishuff_99-A1E76B.16322010022000@news.povray.org> , Chris Huff
<chr### [at] yahoocom>  wrote:

> 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).

You may want to reconsider after reading:
<http://www.AskTog.com/columns/028WebStealers.html>

As a programmer I don't agree with him, but as a user I surely have to :-)


      Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: David Fontaine
Subject: Re: Macro Initialization?
Date: 10 Feb 2000 23:09:25
Message: <38A38B1B.86D18146@faricy.net>
Bill DeWitt wrote:

> DimWitt (3)
> DipShit (2)
> DeTwitt (1)
> DickLick (1)(which my spellchecker thinks should be picklock)
> DeWittless (1)

It's all in good humor...well, maybe not...

--
___     ______________________________________________________
 | \     |_                 <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: Bill DeWitt
Subject: Re: Macro Initialization?
Date: 11 Feb 2000 00:09:58
Message: <38a399a6@news.povray.org>
per <http://www.m-w.com/dictionary.htm>

Main Entry: shat
past and past participle of SHIT


"Peter Popov" <pet### [at] usanet> wrote in message
news:AFCjOLiE2pcJByPRUFOIBbzQ8y=7@4ax.com...
> On Thu, 10 Feb 2000 18:30:21 -0500, "Bill DeWitt"
> <the### [at] earthlinknet> wrote:
>
> >    I once let a "BeShat" slide on account of originality and because he
got
> >the past tense of "to shit" correct.
>
> Ahem, that past tense is a myth last that I cared to check. It follows
> the conjugation of "sit" because they are somewhat related, but it
> could as well have preferred the "fit" way. It's a made-up thing
> afaik.
>
>
> Peter Popov
> pet### [at] usanet
> ICQ: 15002700


Post a reply to this message

From: Gail Shaw
Subject: Re: Macro Initialization?
Date: 11 Feb 2000 02:26:31
Message: <38a3b9a7@news.povray.org>
>gadget(knobs)
>gadget(knobs,lights,dials)
>gadget(dials,dial_light,dial_needle,dial_range)
>


I had a similar problem writing my wall macro.

What I did was to have as macro parameters only those
fields necessarry. At the beginning of the file with the macro in,
I declare variables for the optional stuff to a default. The
user can then redeclare the variables before calling the macro.

eg

// file macro.inc

#declare Var1=0;

#macro ThisandThat(Vara,Varb,varc)
....
// Use var1 somewhere here
....

#end

Works fine for me, also solves the problem of not being able to
remember which parameter comes first.

Gail
*******************************************************************
* gsh### [at] monotixcoza              * ERROR: COFFEE.COM not found  *
* http://www.rucus.ru.ac.za/~gail/ * Insert cup and press any key *
*******************************************************************
* Definition of an upgrade: Take the old bugs out, put new ones in*
*******************************************************************


Post a reply to this message

From: TonyB
Subject: Re: Macro Initialization?
Date: 11 Feb 2000 09:43:43
Message: <38a4201f@news.povray.org>
>DimWitt (3)
>DipShit (2)  <--- hehe...
>DeTwitt (1)
>DickLick (1)  <--- damn...
>DeWittless (1)


I can identify with your problem. I live in a Latin American country, and
"Bennett" has been interpreted (on written documents) in many ways through
my life as well. Here are the most common:

Benneth
Barnett
Bened
Benet
Benete
Penet
Venet
and last but not least: Perez! (only once, so far)

As a matter of fact, they got my last name wrong (Benneth) on the lists of
*all* my professors thoughout my entire 7 years in Instituto Cultural
Bilingüe (goes to show how bilingual they actually were). One teacher was
never able to get past Barnett. I was correcting here the whole year
through, to no avail. In the case of Benete, it usually derives more as it
goes through the system, and by the time I get it back, it has become
Benedete, Beneton, etc.

Oh, and my dad always suffers this problem:

Nombre?
William Bennett
(They write) Benet Williams.

Like nobody has *ever* heard William as a first name, so it *must* be a last
name. :|

And don't even get me started on Mom's name (Ilidia). Nobody has ever
written it the same way twice. *Nobody* So I won't post the list here.


Post a reply to this message

From: Mikael Carneholm
Subject: Re: Macro Initialization?
Date: 11 Feb 2000 10:34:26
Message: <38A42BF8.1F9C0E53@ida.utb.hb.se>
Chris Huff wrote:

> This sounds more like default values for parameters than
> overloading--

You're quite right. I did not read the whole of Bill's post, but replied as
soon as I saw the different declarations of the same macro, assuming he was
asking for overloading. On the other hand, overloaded macros would
definitely be a nice feature. What he is asking for is easiest done by
using an include file, and using #ifndef() in the include file to set
defaults, as Philippe Debar pointed out.

----------------------------------------------------
Mikael Carneholm
Dep. of Computer Science and Business Administration
UCB (University College of Borås) Sweden

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


Post a reply to this message

From: David Fontaine
Subject: Re: Macro Initialization?
Date: 11 Feb 2000 17:55:58
Message: <38A49322.34CC89F6@faricy.net>
<simpsons>
"There will be no more mockery of your name, Mr. Glasscock."
</simpsons>

--
___     ______________________________________________________
 | \     |_                 <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: Bill DeWitt
Subject: Re: Macro Initialization?
Date: 12 Feb 2000 11:44:35
Message: <38a58df3@news.povray.org>
I haven't tested it yet, but I was just wondering if one could pass the
macro an array that initialized some variables...

"Gail Shaw" <gsh### [at] monotixcoza> wrote in message
news:38a3b9a7@news.povray.org...
>
> >gadget(knobs)
> >gadget(knobs,lights,dials)
> >gadget(dials,dial_light,dial_needle,dial_range)
> >
>
>
> I had a similar problem writing my wall macro.
>
> What I did was to have as macro parameters only those
> fields necessarry. At the beginning of the file with the macro in,
> I declare variables for the optional stuff to a default. The
> user can then redeclare the variables before calling the macro.
>
> eg
>
> // file macro.inc
>
> #declare Var1=0;
>
> #macro ThisandThat(Vara,Varb,varc)
> ....
> // Use var1 somewhere here
> ....
>
> #end
>
> Works fine for me, also solves the problem of not being able to
> remember which parameter comes first.
>
> Gail
> *******************************************************************
> * gsh### [at] monotixcoza              * ERROR: COFFEE.COM not found  *
> * http://www.rucus.ru.ac.za/~gail/ * Insert cup and press any key *
> *******************************************************************
> * Definition of an upgrade: Take the old bugs out, put new ones in*
> *******************************************************************
>
>


Post a reply to this message

From: Peter Popov
Subject: Re: Macro Initialization?
Date: 12 Feb 2000 18:26:01
Message: <feulOCzxtSRUtUzBIanP5JsGtUEN@4ax.com>
On Sat, 12 Feb 2000 11:43:51 -0500, "Bill DeWitt"
<the### [at] earthlinknet> wrote:

>I haven't tested it yet, but I was just wondering if one could pass the
>macro an array that initialized some variables...

You can pass an array but the macro will have to rely on specific
variables being in specific places in this array, so no gain here.


Peter Popov
pet### [at] tagpovrayorg
ICQ: 15002700


Post a reply to this message

From: Chris Colefax
Subject: Re: Macro Initialization?
Date: 13 Feb 2000 01:19:14
Message: <38a64ce2@news.povray.org>
Bill DeWitt <the### [at] earthlinknet> 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...
>
> 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.

I had the same problem when I started creating my Spline macro system.  With
my previous (non-macro) include files a set of declarable options worked
well, but it was easy to forget or mistype option variable names, and a
hassle to enter all the #declare ... = ... statements.

If your options are all boolean values then one solution is to code a system
of bitwise operators (as I have in the City Generator).  For more
flexibility, I've created a system for the aforementioned Spline macros
that allows you to specify named options and values, without having to use
any #declare or #local statements.  The technique also catches mistyped
option names as parsing errors, and allows you to specify options ranging
from floats and vectors to objects, pigments, arrays, strings, etc.

If you want to try the technique (and the Spline system), email me for a
copy of the macro file - it's still not finished, but any testing you might
want to do is most appreciated.


Post a reply to this message

From: Bill DeWitt
Subject: Re: Macro Initialization?
Date: 13 Feb 2000 16:52:19
Message: <38a72793@news.povray.org>
"Chris Colefax" <cco### [at] geocitiescom> wrote :
>
> If you want to try the technique (and the Spline system), email me for a
> copy of the macro file - it's still not finished, but any testing you
might
> want to do is most appreciated.
>

    Let's see, do I want a chance to play with an advance copy of a Chris
Colefax Spline system? Let me think about it for a few weeks... YES!


Post a reply to this message

From: David Fontaine
Subject: Re: Macro Initialization?
Date: 13 Feb 2000 17:45:08
Message: <38A73393.5550E791@faricy.net>
I don't know, but macros are a great way to get around the max parameters
thing...

--
___     ______________________________________________________
 | \     |_                 <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: Gail Shaw
Subject: Re: Macro Initialization?
Date: 14 Feb 2000 01:37:06
Message: <38a7a292@news.povray.org>
David Fontaine wrote in message <38A73393.5550E791@faricy.net>...
>I don't know, but macros are a great way to get around the max parameters
>thing...
>


What max parameters thing???

Gail
*******************************************************************
* gsh### [at] monotixcoza              * ERROR: COFFEE.COM not found  *
* http://www.rucus.ru.ac.za/~gail/ * Insert cup and press any key *
*******************************************************************
* Definition of an upgrade: Take the old bugs out, put new ones in*
*******************************************************************


Post a reply to this message

From: Margus Ramst
Subject: Re: Macro Initialization?
Date: 14 Feb 2000 16:20:25
Message: <38A8721B.C61391AE@peak.edu.ee>
Gail Shaw wrote:
> 
> What max parameters thing???
> 

If you don't know, you haven't written a real macro yet :)
POV macros can have a maximum of 20 parameters.

Margus


Post a reply to this message

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