|
|
Here is a bugreport crossposted to povray.programming,
povray.bugreports and directly to Chris Young. It is a
bit hard to reproduce, but if you observe something
similar on a platform other than Linux, please let me
know.
Description of the problem:
Sometimes, povray will complain the the error message
"#while loop didn't end in file where it started." This is
observed in a #while loop containing macros.
Analysis:
I have observed this problem in the IMP POV povray
binary, based on POV 3.1e, and the official Povteam
Linux povray binary of POV 3.1e.
Based on debugging, it is related to the way POV opens
and closes files to execute a macro in a file other than
the one currently being parsed. For some reason, the
current file is closed (tokenize.c:3272 Invoke_Macro )
and re-opened (tokenize.c:3214 Return_From_Macro)
before parsing continues after the macro expansion.
The while loop parser checks if the corresponding
#while and #end tokens are in the same file
(tokenize.c:2382 Parse_Directive), based on
file-pointers. The trouble is, that the "old" file pointer
used for comparison has since been fclose'd, and
may have been recycled for another file. Most of the time,
fclose recycles the identical file pointer, but sometimes
it is a different file-pointer (pointing to the same file)
and povray decides it's thinking about different files.
This test is implemented as follows:
case WHILE_COND:
if (Cond_Stack[CS_Index].While_File != Data_File->File)
{
Error("#while loop didn't end in file where it started.");
}
Fix:
Removing the above if block prevents POV from
falsly reporting the while loop problem. The check
should be re-implemented some other way, perhaps
by reconsidering the close/open behaviour for macro
expansion.
For further information, talk to nig### [at] eisanetau
--
Nigel Stewart (nig### [at] eisanetau) http://www.eisa.net.au/~nigels/
Postgrad Research Student, RMIT University, Melbourne, Australia
All extremists should be taken out and shot.
Post a reply to this message
|
|