POV-Ray : Newsgroups : povray.advanced-users : Multiple #ifdef question Server Time
26 Nov 2024 13:18:55 EST (-0500)
  Multiple #ifdef question (Message 1 to 4 of 4)  
From: David Vincent-Jones
Subject: Multiple #ifdef question
Date: 7 Mar 2000 17:43:42
Message: <38c5861e@news.povray.org>
I am importing, from a generic database, a very large number of items into
an include list.

The items will be classed as possibly 100 distinctly different 'objects',
not all of which will be predefined during the initial display.

When the items are parsed I want a non-defined item to be simply ignored.

I could of course provide an #ifdef....#end around each and every item but I
wonder if there is an easier way, possibly through a macro, to do the job.

David


Post a reply to this message

From: Nieminen Juha
Subject: Re: Multiple #ifdef question
Date: 8 Mar 2000 04:04:27
Message: <38c6179a@news.povray.org>
I don't think it's possible with a macro. Something like this will not work:

#macro Item(name)
  #ifdef(name)
    do_whatever_with name
  #end
#end

because 'name' _is_ always defined in the context of the macro.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Philippe Debar
Subject: Re: Multiple #ifdef question
Date: 9 Mar 2000 04:14:40
Message: <38c76b80@news.povray.org>
"Nieminen Juha" <war### [at] sarakerttunencstutfi> wrote in message
news:38c6179a@news.povray.org...
>   I don't think it's possible with a macro. Something like this will not
work:
>
> #macro Item(name)
>   #ifdef(name)
>     do_whatever_with name
>   #end
> #end
>
> because 'name' _is_ always defined in the context of the macro.


Also, I think calling Item(Name) will cause an error if Name is undefined.
The only legal use of an undefined name I can think of are (1) define it
(with #declare or #local or #macro) and (2) check its "existence"
(definess?) with ifdef / ifndef.


Philippe


Post a reply to this message

From: Ron Parker
Subject: Re: Multiple #ifdef question
Date: 9 Mar 2000 08:20:05
Message: <38c7a505$1@news.povray.org>
On Tue, 7 Mar 2000 14:42:02 -0800, David Vincent-Jones wrote:
>I am importing, from a generic database, a very large number of items into
>an include list.
>
>The items will be classed as possibly 100 distinctly different 'objects',
>not all of which will be predefined during the initial display.

Are the 'objects' such that they can be stored in an array?  If so, MegaPOV
has an extension to the syntax that allows you to check whether a particular
array element is defined, so you could do whatever you're doing inside a loop
or by passing the array and an index to a macro.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

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