|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
platform info: WinNT4, PII 233, 128MB, POV3.5b2
Is name of function treated as identifier like for objects, pigments
and others ?
I'm trying to create such thing:
#declare func=function(x,y,z){x+y+z}
#macro Test(Func)
#local New=function{Func}
#end
Test(func(1,2,3)) // call with parameter as float - works
Test(func) // call with parameter as function - wrong syntax
Second call is wrong but I hav not found notation about it within
documentation. There is note "PARAM_IDENTs are a list of zero or more
formal parameter". Is identifier of function formal parameter ?
more about functions in another post
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
IIRC there's some kind of problem in passing function names as macro
paramters. AFAIK currently it's not possible.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 19 Sep 2001 18:47:51 -0400, Warp wrote:
> IIRC there's some kind of problem in passing function names as macro
>paramters. AFAIK currently it's not possible.
It may not become possible any time soon, either. The problem is that it
requires more than a single token of lookahead to disambiguate between these
two macro calls:
#macro Foo(G)
G
#end
#declare F=function(x,y,z){x,y,z}
#declare H = Foo(F)
#declare I = Foo(F(1,2,3))
--
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 19 Sep 2001 19:10:25 -0400, Ron Parker wrote:
>On 19 Sep 2001 18:47:51 -0400, Warp wrote:
>> IIRC there's some kind of problem in passing function names as macro
>>paramters. AFAIK currently it's not possible.
>
>It may not become possible any time soon, either. The problem is that it
>requires more than a single token of lookahead to disambiguate between these
>two macro calls:
However, this parses correctly and does what you expect. I suggest that it
might want to be written up as either a FAQ entry or as a documentation
thingamawhatzis. Watch out for the returning-locals-from-a-macro bug, though:
#macro Foo( Bar )
#declare X = Bar(Y);
#end
#declare Y=1;
#declare Baz=function(n){n+2}
Foo(function(n){Baz(n)})
#debug str(X,5,5)
#debug "\n"
--
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 19 Sep 2001 19:14:38 -0400, ron### [at] povrayorg (Ron Parker)
wrote:
> However, this parses correctly and does what you expect.
>
> #macro Foo( Bar )
> #declare X = Bar(Y);
> #end
>
> #declare Y=1;
> #declare Baz=function(n){n+2}
>
> Foo(function(n){Baz(n)})
>
> #debug str(X,5,5)
> #debug "\n"
as I understend this solution means function within function (via
parameter declaration) and it is very "expensive" as Thorsten wrote in
<3ba8bda3@news.povray.org>
but of course it is better than nothing
I want thank you all for parameters in functions
it is similiar to my propositions sended some time ago to p.u-p and I
like it very much
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|