![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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 ?
Thanks.
--
sharl.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
sharl wrote:
> Or is there already a good way to avoid multiple including of a file ?
> Thanks.
Planning ahead?
--
Tim Cook
http://empyrean.scifi-fantasy.com
mirror: http://personal.lig.bellsouth.net/lig/z/9/z993126
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In every of my include files, I have a parameter named
_tnw_includefile_ending_
So for my io_macs.inc this would be
_tnw_io_macs_inc_
And its just declared as 1 (similiar to true).
When a different file is based on such an include
file, it checks if that parameter is already declared,
and only includes if its not (using #ifndef).
This doesn't hinder the user from including it once
again AFTER some other include has included it,
but it takes care that all required files will be loaded
at least once, and won't issue warnings.
--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmx de
> 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 ?
> Thanks.
> --
> sharl.
>
>
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <web.3db9de67c659261a49b801190@news.povray.org>,
"sharl" <le.### [at] free fr> 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] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |