POV-Ray : Newsgroups : povray.general : Macro with variable number of parameters... : Re: Macro with variable number of parameters... Server Time
29 Jul 2024 12:14:36 EDT (-0400)
  Re: Macro with variable number of parameters...  
From: Rainer Mager
Date: 21 Jun 1999 21:36:14
Message: <376ee88e@news.povray.org>
This probably isn't ideal but how about...

#macro myMacro2( val1, val2 )
    myRealMacro( val1, val2, "" )
#end

#macro myMacro3( val1, val2, val3 )
    myRealMacro( val1, val2, val3 )
#end

#macro myRealMacro( val1, val2, val3 )
    ...
#end

...and use they both as...

myMacro2( val1, val2 )
myMacro3( val1, val2, val3 )


--Rainer

<con### [at] geocitiescom> wrote in message
news:376a8bf8$1$pbaarep$mr2ice@news.povray.org...
> Is it possible to create a macro with a variable number of
> parameters?
>
>
> I'm trying to create a macro that counts the number of
> parameters passed to it and then issue the #macro definition.
>
> Is this possible?
>
> I want a way to make it so the user doesn't have to provide
> information that isn't necessary.  Based on the value of the
> first parameter, the second is always needed, but the third
> may not be.  I'd like to allow the user to do the following.
>
> myMacro(0,"a")
>
> or
>
> myMacro(1,"a","b")
>
> The first and second parameter are needed, but if the first is a 0
> (instead of a 1) the third value isn't necessary.
>
> Anyone have any ideas?
>
> --
> ============================================================
>   Suburbia is where the developer bulldozes out the trees,
>   then names the streets after them.
>
>   -- Bill Vaughn
> ============================================================
>    Friday, June 18, 1999 - 02:06 PM (EDT)
> ============================================================
>
> _-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~~~~~~~~~~-_
> +                                   +            +
> +   Chris C. Conner                 +    This    +
> +   cco### [at] amerisurecom-NOSPAM    +    space   +
> +   con### [at] geocitiescom-NOSPAM    +    for     +
> +   con### [at] usanet-NOSPAM          +    rent    +
> +                                   +            +
> ~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-__________-~
>


Post a reply to this message

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