POV-Ray : Newsgroups : povray.beta-test : [scenes] woodmaps.inc : Re: [scenes] woodmaps.inc Server Time
30 Jul 2024 06:32:04 EDT (-0400)
  Re: [scenes] woodmaps.inc  
From: Warp
Date: 28 Jan 2002 21:34:19
Message: <3c560a2b@news.povray.org>
Christopher James Huff <chr### [at] maccom> wrote:
: As far as I know, the POV SDL *does* make this assumption. You missed 
: his point...there is no way of knowing the end of the block is at the 
: end of the file. It has to search to find the matching #end, and it has 
: to do this starting forward from the #if statement.

  Sorry, but I don't understand. What's the problem with this?
  Of course it searches for the #end correspondent to the #if. So? If, when
it encounters the #include command, it does not actually include the given
file, I don't see any problem here. The behaviour is exactly what I meant.

  Perhaps my point was not clear. Let me profundize:

  The usual way of "speeding up" parsing and avoiding multiple declaration
of things is to put lines like these in the include file:

// Beginning of the file
#ifndef _INCLUDE_FILE_1_
#declare _INCLUDE_FILE_1_ = yes;

(contents of the include file)

#end
// End of the include file

  Suppose that was "IncFile1.inc".
  Also suppose that we have another include file named "IncFile2.inc" which
needs the above one and thus includes it.
  Now, if "IncFile2.inc" does this in the usual way, ie:

#include "IncFile1.inc"

and "IncFile1.inc" was already read somewhere earlier, then this is slow, as
povray has to parse the entire "IncFile1.inc" file.
  However, what we do in "IncFile2.inc" instead, is this:

#ifndef _INCLUDE_FILE_1_
  #include "IncFile1.inc"
#end

  If "IncFile1.inc" has already been included somewhere earlier and povray
just skips that #include command and doesn't actually read the contents
of "IncFile1.inc", then it's much faster.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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