POV-Ray : Newsgroups : povray.beta-test : Still a first function initialisation error? Server Time
30 Jul 2024 02:19:34 EDT (-0400)
  Still a first function initialisation error? (Message 1 to 9 of 9)  
From: Michael Andrews
Subject: Still a first function initialisation error?
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

From:
Subject: Re: Still a first function initialisation error?
Date: 6 Feb 2002 08:02:35
Message: <u3a26u882pp7dhm2ivnncrdarh2pa63m9l@4ax.com>
On Wed, 06 Feb 2002 12:54:30 +0000, Michael Andrews <M.C### [at] readingacuk>
wrote:
> As the code stands it fails parsing at the pigment statement with 'Parse 
> Error: Attempt to access an uninitialized array element.'

I can confirm this behaviour, but I think it is somehow connected with arrays.
When you remove array (as below) then it works fine

// -- start ---
#declare f_PT0 = function { abs(sin(x)*sin(y)) }
#declare f_PT1 = function { abs(sin(x)*sin(y)) }

plane { -z, 0
   pigment { function { f_PT0(x,y,z) } } // <- parse _not_ 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 --

POV 3.5 b 10 icl on WinNT Sp 6 PII 233 with 128 MB

ABX


Post a reply to this message

From: Warp
Subject: Re: Still a first function initialisation error?
Date: 6 Feb 2002 09:02:20
Message: <3c61376b@news.povray.org>
Michael Andrews <M.C### [at] readingacuk> wrote:
: f_PT[0](x,y,z)

  I would guess that the parser just doesn't support this []() syntax (someone
forgot adding support for it, or whatever).
  IMHO this should be fixed.

-- 
#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

From: Michael Andrews
Subject: Re: Still a first function initialisation error?
Date: 6 Feb 2002 09:43:19
Message: <3C6142A3.4030305@reading.ac.uk>


> I can confirm this behaviour, but I think it is somehow connected with arrays.

But when you use an array of simple pigments it works right, and if you 
put any function declaration before the array function declarations it 
also works ...

Mike.


Post a reply to this message

From: Ron Parker
Subject: Re: Still a first function initialisation error?
Date: 6 Feb 2002 12:12:42
Message: <slrna62p0c.5tk.ron.parker@fwi.com>
On 6 Feb 2002 09:02:20 -0500, Warp wrote:
> Michael Andrews <M.C### [at] readingacuk> wrote:
>: f_PT[0](x,y,z)
> 
>   I would guess that the parser just doesn't support this []() syntax (someone
> forgot adding support for it, or whatever).

Unlikely, since it reportedly works when you put in a subscript of 1.

Also, the tokenizer doesn't care about what comes after the []; it parses
the array reference at too high a level to care.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Still a first function initialisation error?
Date: 6 Feb 2002 13:41:47
Message: <3c6178eb@news.povray.org>
In article <3C6### [at] readingacuk> , Michael Andrews 
<M.C### [at] readingacuk>  wrote:

> I could not see the 'first function in code initialisation problem'
> listed in the current bug list, so maybe I'm trying something odd?

If is a different bug with the same cause and symptoms.  It will be fixed in
the next beta.

    Thorsten

____________________________________________________
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

From: Michael Andrews
Subject: Re: Still a first function initialisation error?
Date: 7 Feb 2002 05:30:10
Message: <3C6258D3.7000908@reading.ac.uk>
> If is a different bug with the same cause and symptoms.  It will be fixed in
> the next beta.
> 
>     Thorsten

Hi Thorsten,

I'm glad it was an actual bug, and even happier you could fix it so 
quickly :-)

Many thanks,
	Mike Andrews.


Post a reply to this message

From: Michael Andrews
Subject: Re: Still a first function initialisation error?
Date: 11 Feb 2002 06:37:29
Message: <3C67AE7C.6030706@reading.ac.uk>
> If is a different bug with the same cause and symptoms.  It will be fixed in
> the next beta.
> 
>     Thorsten

Hi Thorsten,

Sorry, but the test code I posted now crashes beta 11, rather than being 
caught in the parser.

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

Mike Andrews.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Still a first function initialisation error?
Date: 11 Feb 2002 07:11:12
Message: <3c67b4e0@news.povray.org>
In article <3C6### [at] readingacuk> , Michael Andrews 
<M.C### [at] readingacuk>  wrote:

> Sorry, but the test code I posted now crashes beta 11, rather than being
> caught in the parser.

Hmm, works fine for me.  Maybe there is some side effect.  I will check
this...

    Thorsten

____________________________________________________
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

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