POV-Ray : Newsgroups : povray.general : #ifdef using a string expression? : Re: #ifdef using a string expression? Server Time
23 Apr 2024 23:13:35 EDT (-0400)
  Re: #ifdef using a string expression?  
From: William F Pokorny
Date: 22 Mar 2023 07:20:27
Message: <641ae47b$1@news.povray.org>
On 3/21/23 07:43, Kenneth wrote:
> Well... In the light of a new day, I remembered that I had seen that
> *somewhere*; it's not an "obscure built-in identifier" 😅  It's just 'a name'
> or variable-- part of an #ifdef block at the top of every 'official' POV-ray
> include file, with a simple #debug statement:
> 
>               #ifdef(View_POV_Include_Stack)
>               #debug "including arrays.inc\n"
>               #end
> 
> It's just a useful/descriptive phrase that someone came up with in the past.
> Which explains why adding    #declare View_POV_Include_Stack = true;   at the
> top of your main scene file results in a list of those #included files in
> 'messages'.  Duh. No special magic.

With my povr branch I have for a while been set up with two basic 
targeted compiles.

One is a debug option with a lot of extra checking and reporting 
enabled. The other is the day to day rendering version to be used when 
things are going well.

The idea is to use the faster one as a rule.

However, on seeing flaky behavior, or when just wanting to do more 
robust checking of your scene to find what evil is lurking - run the 
debug compile version.

On reading your post I had the thought, why not add some detailed 
include information to the targeted debug compile version of povr. I did 
- and the output currently looks like:

==== [Parsing...] ==============================================
Debug: #include "functions.inc"
Debug: #include "/run/shm/tmpDir/povrayB/include/transforms.inc"
Debug: #include "/run/shm/tmpDir/povrayB/include/math.inc"
Debug: #include "functions.inc"
Debug: #include "/run/shm/tmpDir/povrayB/include/setidtypes.inc"
Debug: #include "/run/shm/tmpDir/povrayB/include/vectors.inc"
Debug: #include "/run/shm/tmpDir/povrayB/include/vectors.inc"
Debug: #include "/run/shm/tmpDir/povrayB/include/math.inc"
Debug: #include "/tmp/otherInc/whackJob.inc"

This information which I'll find useful on occasion too! Oh, the scene 
has only these four includes:

#include "functions.inc"
#include "transforms.inc"
#include "math.inc"
#include "whackJob.inc"

So, the larger reported set is due some of those includes having 
includes too. With well formed include files, only the first in the 
debug output is really used.

On using: #declare View_POV_Include_Stack = 1; we see:

including function.inc
including transforms.inc
including math.inc
including setidtypes.inc
including vectors.inc

We don't see whackJob.inc just above because the guy who wrote it did 
not add the debug code that is in all core shipped include files.

Aside: There are exposures with the View_POV_Include_Stack method in 
that the name reported is whatever is in the debug statement and not 
really the name of the file included. They should align, but...

---

With regards to the #ifdef(), #ifndef(), the povr fork has been reverted 
to v3.7,v3.6 behavior in looking only for declared IDs. With the one 
exception that empty parenthesis now returns false or true, 
respectively, without introducing odd, hard to understand parsing fails 
as a rule.

Bill P.


Post a reply to this message

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