POV-Ray : Newsgroups : povray.newusers : weird macro error Server Time
29 Jul 2024 06:24:01 EDT (-0400)
  weird macro error (Message 1 to 4 of 4)  
From: CdeathJd
Subject: weird macro error
Date: 18 Sep 2006 19:55:00
Message: <web.450f319fe8b4b0ebe2e0912a0@news.povray.org>
Hi, can someone please explain where this code is going wrong, it gives the
error message "PARSE ERROR: EXPECTED `STRING`, END OF FILE FOUND INSTEAD"

==============================================================================

#macro Save_Fires()
#declare index=0;

  #fopen IFV_File "Fires.inc" write
  #write ( IFV_File, "// This is a generated file which " )
  #write ( IFV_File, "can probably be deleted without too much harm.n" )
  #write ( IFV_File, concat("#declare fire_array=array[1001][9]n" )

#while (index<MAX_FIRE)

  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][0]=",
str(fire_array[index] [0],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][1]=",
str(fire_array[index] [1],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][2]=",
str(fire_array[index] [2],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][3]=",
str(fire_array[index] [3],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][4]=",
str(fire_array[index] [4],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][5]=",
str(fire_array[index] [5],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][6]=",
str(fire_array[index] [6],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][7]=",
str(fire_array[index] [7],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][8]=",
str(fire_array[index] [8],0,3),";n" ))

  #declare index=index+1;

#end
  #fclose IFV_File
#end

==============================================================================

FYI it highlights the second to last line when it gives this message
(#fclose etc etc)

After this line is a lot more code, and there is more after the macro is
called, so why is it given this error?


Post a reply to this message

From: Mike Williams
Subject: Re: weird macro error
Date: 19 Sep 2006 02:38:47
Message: <F+gCQVAwB5DFFwEK@econym.demon.co.uk>
Wasn't it CdeathJd who wrote:
>Hi, can someone please explain where this code is going wrong, it gives the
>error message "PARSE ERROR: EXPECTED `STRING`, END OF FILE FOUND INSTEAD"

The parser is still looking for the final ")" to match the one on this
line, having parsed several lines of code as part of the concat()
parameters, it gets a bit confused.

>  #write ( IFV_File, concat("#declare fire_array=array[1001][9]n" )

Either add a ")" to the end of that line, or (better) remove the
"concat("

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: CdeathJd
Subject: Re: weird macro error
Date: 19 Sep 2006 07:25:00
Message: <web.450fd2b72a8514e5e2e0912a0@news.povray.org>
Cheers! I should have spotted that! But it was really late!
now i have a bigger and less obvious error, i get the error "RENDERING
ERROR: TOO MANY NESTED OBJECTS".

This is the povray file that gives the error:

// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Checkered Floor Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"

#declare MAX_FIRE=1000;

global_settings {
  assumed_gamma 1.0
  max_trace_level 5
}
#declare fire_array=array[MAX_FIRE][10];

#declare a=0;
#while (a<MAX_FIRE)
        #declare fire_array[a][0]=0;
        #declare fire_array[a][1]=0;
        #declare fire_array[a][2]=0;
        #declare fire_array[a][3]=0;
        #declare fire_array[a][4]=0;
        #declare fire_array[a][5]=0;
        #declare fire_array[a][6]=0;
        #declare fire_array[a][7]=0;
        #declare fire_array[a][8]=0;
        #declare fire_array[a][9]=0;
        #declare a=a+1;
#end

#include "Fires.inc"

#macro Save_Fires()
#declare index=0;

  #fopen IFV_File "Fires.inc" write
  #write ( IFV_File, "// This is a generated file which " )
  #write ( IFV_File, "can probably be deleted without too much harm.n" )
//  #write ( IFV_File, concat("#declare fire_array=array[1001][9]n" )
  #write ( IFV_File, "#declare fire_array=array[1001][10]n" )

#while (index<MAX_FIRE)

  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][0]=",
str(fire_array[index] [0],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][1]=",
str(fire_array[index] [1],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][2]=",
str(fire_array[index] [2],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][3]=",
str(fire_array[index] [3],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][4]=",
str(fire_array[index] [4],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][5]=",
str(fire_array[index] [5],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][6]=",
str(fire_array[index] [6],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][7]=",
str(fire_array[index] [7],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][8]=",
str(fire_array[index] [8],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][9]=",
str(fire_array[index] [9],0,3),";n" ))

  #declare index=index+1;

#end
  #fclose IFV_File
#end


#declare r1=seed(sin(clock*clock*clock)*0.2);

#declare index=0;
#while (index<2)    //10 is self set max spawn rate per frame
  #if (rand(r1)>0.1)
        #declare index2=0;
        #while (index2<MAX_FIRE)
                #if (fire_array[index2][0]=0)
                        #declare fire_array[index2][0]=1;      //EXISTS
                        #declare fire_array[index2][1]=0;       //XPOS
                        #declare fire_array[index2][2]=0;       //YPOS
                        #declare fire_array[index2][3]=0;       //ZPOS
                        #declare fire_array[index2][4]=1;       //XVEL
                        #declare fire_array[index2][5]=-2;       //YVEL
                        #declare fire_array[index2][6]=1;       //ZVEL
                        #declare fire_array[index2][7]=30+(rand(r1)*25);
//scale
                        #if (rand(r1)>0.8)
                                #declare fire_array[index2] [8]=1;  //WARP
EFFECT
                        #end
                        #declare fire_array[index2][9]=rand(r1);
//life
                #else
                        sphere {
                        #declare
fire_array[index2][1]=fire_array[index2][1]+fire_array[index2][4];
                        #declare
fire_array[index2][2]=fire_array[index2][2]+fire_array[index2][5];
                        #declare
fire_array[index2][3]=fire_array[index2][3]+fire_array[index2][6];
                        <fire_array[index2][1], fire_array[index2][2],
fire_array[index2][3]> // center of sphere <X Y Z>
                        fire_array[index2][7]       // radius of sphere
                        }
                        #declare
fire_array[index2][9]=fire_array[index2][9]-0.02;
                        #declare
fire_array[index2][7]=fire_array[index2][7]*fire_array[index2][9];

                        #if (fire_array[index2][9]<0.02)
        #declare fire_array[index2][0]=0;
        #declare fire_array[index2][1]=0;
        #declare fire_array[index2][2]=0;
        #declare fire_array[index2][3]=0;
        #declare fire_array[index2][4]=0;
        #declare fire_array[index2][5]=0;
        #declare fire_array[index2][6]=0;
        #declare fire_array[index2][7]=0;
        #declare fire_array[index2][8]=0;
        #declare fire_array[index2][9]=0;
                        #end
                #end
                #declare index2=index2+1;
        #end
  #end
  #declare index=index+1;
#end


// ----------------------------------------

camera {
  location  <0.0, 0.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
  angle 75
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

plane {               // checkered floor
  y, -1
  texture
  {
    pigment {
      checker
      color rgb 1
      color blue 1
      scale 0.5
    }
    finish{
      diffuse 0.8
      ambient 0.1
    }
  }
}

sphere {              // reflective sphere
  <0,50,200>, 100
  texture {
    pigment {
      color rgb <0.8,0.8,1.0>
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.8
        metallic
      }
      conserve_energy
    }
  }
}

Save_Fires()


Post a reply to this message

From: Mike Williams
Subject: Re: weird macro error
Date: 19 Sep 2006 08:21:30
Message: <2qbOlDAd39DFFwCt@econym.demon.co.uk>
Wasn't it CdeathJd who wrote:
>
>Cheers! I should have spotted that! But it was really late!
>now i have a bigger and less obvious error, i get the error "RENDERING
>ERROR: TOO MANY NESTED OBJECTS".

I don't understand where that error is coming from, but try changing

    #declare fire_array=array[MAX_FIRE][10];
to
    #declare fire_array=array[MAX_FIRE+1][10];

and see if that's any better.

And also try changing all those "n"s into "\n"s unless it's a bug in
your mailserver that's causing the "\" characters to be omitted.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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