POV-Ray : Newsgroups : povray.beta-test : Still a first function initialisation error? : Still a first function initialisation error? Server Time
30 Jul 2024 00:18:55 EDT (-0400)
  Still a first function initialisation error?  
From: Michael Andrews
Date: 6 Feb 2002 07:47:35
Message: <3C612786.9000004@reading.ac.uk>
I could not see the 'first function in code initialisation problem' 
listed in the current bug list, so maybe I'm trying something odd?

Here is the test code:-

// -- start ---
#declare f_PT = array [2]
#declare f_PT[0] = function { abs(sin(x)*sin(y)) }
#declare f_PT[1] = function { abs(sin(x)*sin(y)) }

plane { -z, 0
   pigment { function { f_PT[0](x,y,z) } } // <- parse fails
   finish { ambient 1 diffuse 0 }
}

camera {
   location -30*z up y
   right x*image_width/image_height
   direction 2*z look_at 0
}
// -- end --

As the code stands it fails parsing at the pigment statement with 'Parse 
Error: Attempt to access an uninitialized array element.'

Using f_PT[1] works correctly.

Also if a line such as

#declare FIX = function {1}

is added at the start of the code, there is no problem using f_PT[0].

I think this (or a related) error was causing PoV to crash with a more 
complex usage, not getting caught in the parser.

System: 1GHz Athlon, 256MB, WinNT4 sp6, PoV 3.5.beta.10 win32 (.icl)

Mike Andrews.


Post a reply to this message

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