POV-Ray : Newsgroups : povray.binaries.images : Strange behaviour of #fopen Server Time
7 Nov 2024 21:53:57 EST (-0500)
  Strange behaviour of #fopen (Message 1 to 3 of 3)  
From: Jörg 'Yadgar' Bleimann
Subject: Strange behaviour of #fopen
Date: 5 Feb 2014 11:18:33
Message: <52f26459$1@news.povray.org>
Hi(gh)!

I want to read in a POV-Ray script from an external file to create a 
text object out of it - but whenever I try to start the main script, I 
get the error message related to the script to be read in:

"Parse Error: Expected 'float, vector, or string literal' light_source 
found instead"

Why that?

Here is the relevant section of the main script:

#declare fullscript = array[483];
#declare i=0;

#declare line="";

#fopen script "../../texturesinc_demo.pov" read
#while (defined(script))
   #read (script, line)
   #declare fullscript[i] = line;
   #declare i=i+1;
#end

#fclose script

See you in Khyberspace!

Yadgar


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Strange behaviour of #fopen
Date: 5 Feb 2014 18:44:25
Message: <52f2ccd9@news.povray.org>
> I want to read in a POV-Ray script from an external file to create a
> text object out of it - but whenever I try to start the main script, I
> get the error message related to the script to be read in:
>
> "Parse Error: Expected 'float, vector, or string literal' light_source
> found instead"
>
> Why that?

 From the documentation of "#read":

"
The format of the data to be read must be a series of valid string 
literals, float literals, or vector literals separated by commas.
"

Basically this means you cannot read arbitrary text files,
only "csv-like" data files. Also, AFAIK, the implementation of
#read to some extent reuses the POV-Ray expression parser, so
you might get strange messages reading source files.


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Strange behaviour of #fopen
Date: 5 Feb 2014 19:41:41
Message: <52f2da45$1@news.povray.org>
Hi(gh)!

On 06.02.2014 00:44, Christian Froeschlin wrote:
>  From the documentation of "#read":
>
> "
> The format of the data to be read must be a series of valid string
> literals, float literals, or vector literals separated by commas.
> "

Ah yes, I remember... so I have started to enclose each line with "", 
followed by a comma - and, indeed, now the error message points at the 
first line not treated this way!

Thank you for the hint!

See you in Khyberspace!

Yadgar


Post a reply to this message

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