|
|
Florian Brucker <tor### [at] torfboldcom> wrote:
> M1(Param)
I didn't test, but doing "M1((Param))" should do what you expect.
The behaviour of the parser is interesting with regard to #local and
macro parameters. AFAIK if you give an identifier directly as a macro
parameter, any #local inside that macro will modify the original
identifier. If you give a *value* (instead if an identifier) as parameter,
the macro will get a copy of that value and will only modify this temporary
copy.
Putting the identifier into parentheses will make it an expression
which resulting value will be given as parameter instead of the identifier
itself. That is, the difference between "Param" and "(Param)" is that
the first is an identifier (which is then modified in the macro) while
the second is a float expression (which result is the value of Param),
which value is temporarily copied to the macro.
The difference is similar to doing "void foo(int& i)" or "void foo(int i)"
in C++, but the syntactical difference is more subtle (because you decide
whether the parameter is passed by reference or by value at the calling
place instead of the macro definition).
If you want to be sure that your macro will not modify an identifier
given as parameter, you should make an explicit copy of it inside your
macro.
I think this should be explained in the documentation if it's not already.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|