POV-Ray : Newsgroups : povray.general : POV crash with functions : Re: POV crash with functions Server Time
4 Aug 2024 02:16:14 EDT (-0400)
  Re: POV crash with functions  
From: Christoph Hormann
Date: 11 Nov 2003 04:42:03
Message: <edn681-p93.ln1@triton.imagico.de>
Thorsten Froehlich wrote:
> 
> This isn't legal syntax and POV-Ray cannot currently detect this properly.

Isn't there a possibility to prevent the crash?

> To do what you want, use #declare instead of #local like this:
> 
> #macro F_Plane ()
>    #undef fn_p
>    #declare fn_p=function (x,y,z) { y };
>    fn_p
> #end

Note this is an undocumented feature.  In fact function declarations are 
not listed in the #declare documentation at all:

DECLARATION:
     #declare IDENTIFIER = RVALUE |
     #local IDENTIFIER = RVALUE
RVALUE:
     FLOAT; | VECTOR; | COLOR; | STRING | OBJECT | TEXTURE |
     PIGMENT | NORMAL | FINISH | INTERIOR | MEDIA | DENSITY |
     COLOR_MAP | PIGMENT_MAP | SLOPE_MAP | NORMAL_MAP |
     DENSITY_MAP | CAMERA | LIGHT_SOURCE | FOG | RAINBOW |
     SKY_SPHERE | TRANSFORM


Function documentation only lists the full declarations:

FUNCTION_IDENTIFIER:
     #local FUNCTION_IDENTIFIER = function { FLOAT }               |
     #declare FUNCTION_IDENTIFIER = function { FLOAT }             |
     #local FUNCTION_IDENTIFIER = function(IDENT_LIST) { FLOAT }   |
     #declare FUNCTION_IDENTIFIER = function(IDENT_LIST) { FLOAT } |
     #local FUNCTION_IDENTIFIER = function{SPECIAL_FLOAT_FUNCTION} |
     #local VECTOR_IDENTIFIER = function{SPECIAL_VECTOR_FUNCTION}  |
     #local COLOR_IDENTIFIER = function { SPECIAL_COLOR_FUNCTION } |


Calls to user defined functions are missing in the 'Float Expressions' 
as well.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

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