|
|
Hi folks,
I was looking at the file read/write directives last night and hit a
feature I wasn't expecting; #declares seem to be _parsed_ automatically
if they occur in a file before a readable item.
Here's a file showing what I mean:-
// begin pov code
#fopen Test "test.txt" write
#declare Text = "#declare A = \"A short string of text.\nAnd another
after new line.\"\n"
#write (Test, Text)
#declare Text = "#declare S = sphere { 10*z, 1 pigment { rgb 0.8 }
finish { ambient 1 } }\n"
#write (Test, Text)
#declare Text = "\"More text.\"\n"
#write (Test, Text)
#fclose Test
#declare Text = ""
#fopen Test "test.txt" read
#read (Test, Text)
#debug concat("Text = ", Text, "\n")
#fclose Test
/* Here come the wierd bits ... */
// 'A' is only #declared in a string that is written
// to file and parsed back in somehow.
#debug concat("A = ", A, "\n")
// 'S' is only #declared in the file as well ...
object { S }
// end pov code
Is this feature documented (is it even usefull?) or is it just a
side effect of how the parser works?
All this stemmed from not reading the documentation first and trying
to write a pov scene that could read an image file to figure out where
to place objects ... now that would be useful, yes?
Bye for now,
Mike Andrews.
Post a reply to this message
|
|