POV-Ray : Newsgroups : povray.general : #include vs #require : Re: #include vs #require Server Time
5 Aug 2024 08:28:21 EDT (-0400)
  Re: #include vs #require  
From: Christopher James Huff
Date: 25 Oct 2002 21:02:29
Message: <chrishuff-5B0C8F.20553425102002@netplex.aussie.org>
In article <web.3db9de67c659261a49b801190@news.povray.org>,
 "sharl" <le.### [at] freefr> wrote:

> Would it be possible to add a #require command, as in php.
> This would add the file only *once* for each scene, no matter
> how often the #require"this_file" is found.
> 
> Or is there already a good way to avoid multiple including of a file ?

The usual way is to use an "inclusion guard", something like this:

#ifndef MYFILE_INC
#declare MYFILE_INC = true;

...file contents...

#end

The official include files combine this with a way of saving the version 
and restoring it at the end of the file.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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