POV-Ray : Newsgroups : povray.newusers : Use of macros returning values : Use of macros returning values Server Time
29 Jul 2024 14:24:55 EDT (-0400)
  Use of macros returning values  
From: Steve
Date: 7 Sep 2005 11:25:00
Message: <web.431f0609ffcf6ed9b279c3b00@news.povray.org>
I'm attempting to write a macro that looks up a value in a table, as follows

#macro __get_table_element1( tbl, e, n )

 // Macro to calculate interpolated value from table.

 #local tick = clock * 1399;
 #local ftick = floor( tick );
 #local i0 = ( ftick * n ) + e;
 #local i1 = i0 + n;

 #if ( 1399 - ftick )

  ( tbl[i1] )

 #else

  ( tbl[i0] )

 #end

#end

When I invoke the macro, as here

 #local q10 = __get_table_element1( clip_array, 0, 6 )

for example, I get the folloiwng error:

File: fnord  Line: 141
Possible Parse Error: All #version and #declares of float, vector, and color
 require semi-colon ';' at end.

In order to get the script to work, I have to run in version 3.1 mode.

If I add a semicolon, either after the return value or at the end of the
local declaration, I get a syntax error.

I believe I've R'd TFM, but I may have missed something.

Thanx.


Post a reply to this message

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