POV-Ray : Newsgroups : povray.advanced-users : Detecting .inc file inclusion from another file Server Time
23 Dec 2024 12:33:43 EST (-0500)
  Detecting .inc file inclusion from another file (Message 1 to 4 of 4)  
From: stbenge
Subject: Detecting .inc file inclusion from another file
Date: 19 Jun 2010 16:37:33
Message: <4c1d2a8d@news.povray.org>
Hi,

Is there a method for finding out if an .inc file was included from 
another file, within the included file itself? For instance, if I wanted 
to make an include file which doubles as both an include *and* a scene 
file, I would not want the camera, lights, etc. to be included along 
with it.

Sam


Post a reply to this message

From: clipka
Subject: Re: Detecting .inc file inclusion from another file
Date: 19 Jun 2010 17:03:29
Message: <4c1d30a1$1@news.povray.org>
Am 19.06.2010 22:37, schrieb stbenge:

> Is there a method for finding out if an .inc file was included from
> another file, within the included file itself?

None that I know of - unless you know which file(s) it might be included 
by, and setting a certain variable there before including. E.g.:

//---------------------------
// my_scene.pov
//---------------------------
#declare MY_INCLUDE_FLAG = 1;
#incude "my_include_file.inc"
...

//---------------------------
// my_include_file.inc
//---------------------------
#ifndef (MY_INCLUDE_FLAG)
   // set camera etc.
#end
...


Post a reply to this message

From: SharkD
Subject: Re: Detecting .inc file inclusion from another file
Date: 19 Jun 2010 17:48:41
Message: <4c1d3b39$1@news.povray.org>
On 6/19/2010 4:37 PM, stbenge wrote:
> Hi,
>
> Is there a method for finding out if an .inc file was included from
> another file, within the included file itself? For instance, if I wanted
> to make an include file which doubles as both an include *and* a scene
> file, I would not want the camera, lights, etc. to be included along
> with it.
>
> Sam

Yeah, I requested this feature not too long ago. Would be nice.

-- 
http://isometricland.com


Post a reply to this message

From: stbenge
Subject: Re: Detecting .inc file inclusion from another file
Date: 19 Jun 2010 18:18:12
Message: <4c1d4224@news.povray.org>
clipka wrote:
> Am 19.06.2010 22:37, schrieb stbenge:
> 
>> Is there a method for finding out if an .inc file was included from
>> another file, within the included file itself?
> 
> None that I know of - unless you know which file(s) it might be included 
> by, and setting a certain variable there before including. E.g.:
> 
> //---------------------------
> // my_scene.pov
> //---------------------------
> #declare MY_INCLUDE_FLAG = 1;
> #incude "my_include_file.inc"
> ...
> 
> //---------------------------
> // my_include_file.inc
> //---------------------------
> #ifndef (MY_INCLUDE_FLAG)
>   // set camera etc.
> #end
> ...

That's a good idea, thanks!


Post a reply to this message

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