|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm not sure - is it supposed in beta 15 to be possible to pass functions to
macros? How do I do that? ...when using more than just the x, y, and z
variables?
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Mar 19)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Sat, 6 Apr 2002 00:33:10 +0200, "Rune" <run### [at] mobilixnetdk> wrote:
> I'm not sure - is it supposed in beta 15 to be possible to pass functions to
> macros? How do I do that? ...when using more than just the x, y, and z
> variables?
#local Sum=function( A , B , C , D , E , F ) { A + B + C + D + E + F };
#macro Run( F )
#local Result = F( 1,2,3,4,5,6 );
#warning str( Result , 0 , -1 )
#end
Run( function(A,B,C,D,E,F){ Sum(A,B,C,D,E,F) } )
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Run( function(A,B,C,D,E,F){ Sum(A,B,C,D,E,F) } )
Oh, right... thanks!
I really hate the way functions are passed to macros though. It's a whole
new level of clumsiness... :(
I wish it could be possible to do:
Run(Sum)
But that won't happen before POV-Ray 4.0, and that's just if we're lucky...
(This is not a critique to the POV-Team at all).
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Mar 19)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I wish it could be possible to do:
>
> Run(Sum)
I agree, this would be logical.
Strange that it doesn't work.
Regards,
Hugo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Sat, 6 Apr 2002 12:58:47 +0200, "Hugo" <hua### [at] post3teledk> wrote:
> I agree, this would be logical.
> Strange that it doesn't work.
Feel free to investigate difficulties of implementation after source release :-)
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3caed2ed$1@news.povray.org> , "Hugo" <hua### [at] post3teledk> wrote:
> Strange that it doesn't work.
In computer science terms (and as it has been explained several times before),
the current POV-Ray parser is a recursive decent parser which is a plain and
simple LL(1) parser. In order to parse "Run(Sum)" one needs a more complex
LR(1) parser to handle the more complex grammar. Essentially an LR(k) parser,
just like a human, is able to read to the end of a sentence and then able to
make sense out of it while the LL(k) parser is only able to look at the next
word and then has to guess what you are up to without having read to the end.
This said however, I have to admit that LR(1) is only relevant for some "odd"
features of #declares and not macro parameters. In order to parse macro
parameters correctly it is sufficient to modify the current parser to be
"nearly an LL(2) parser". To be more precise, by some tricky but small
internal changes it is possible to keep enough information and perform a two
token look-ahead for functions*, which is sufficient to determine if it is a
function call or not...
Thorsten
* I have not checked yet if the same is possible for splines with easy
modifications as well.
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|