POV-Ray : Newsgroups : povray.general : Macro Initialization? Server Time
10 Aug 2024 13:18:55 EDT (-0400)
  Macro Initialization? (Message 21 to 27 of 27)  
<<< Previous 10 Messages Goto Initial 10 Messages
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

<<< Previous 10 Messages Goto Initial 10 Messages

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