|
|
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > Could someone please post a small, simple macro that results in a scalar, a
> > vector, and an array getting passed "out" to the global SDL world?
>
> You can pass them back through the macro arguments by declaring the formal
> parameters with the final results. For example:
>
> #macro MyMacro (S, V, A)
> #declare S = 1;
> #declare V = <2, 3, 4>;
> #declare A = array[5]
> #for (I, 0, 4)
> #declare A[I] = pow (I, 2);
> #end
> #end
>
> The argument identifiers would need to be declared with dummy values before
> passing them to the macro.
>
> Be careful with this technique. It is frowned upon in structured programming,
> but without heterogeneous data structure capability, POV-Ray SDL leaves you
> little choice.
I see what you're doing - I'd call that "redeclaring" the values of existing
variables.
Could you perhaps illuminate me as to how say, array A, on a line all its own,
gets passed out of a macro?
I have both sucessfuly and unsuccessfully done it that way, but I can't clearly
see what happens to make it work or not work.
So, for instance:
#macro MyMacro (Input)
#declare Output = pow (Input, 2);
Output
#end
#declare Variable = MyMacro (2);
Can I have several lines such as
Output1
Output2
Output3 ?
Can I have SDL inside the macro that creates a sphere and then returns Input^2 ?
I'm trying to understand the "mechanics" and all too often failing.
Thanks for your assistance :)
Post a reply to this message
|
|