POV-Ray : Newsgroups : povray.general : __FILE__ and __LINE__ equiv. in POV macros? Server Time
15 Nov 2024 09:19:27 EST (-0500)
  __FILE__ and __LINE__ equiv. in POV macros? (Message 1 to 3 of 3)  
From: John M  Dlugosz
Subject: __FILE__ and __LINE__ equiv. in POV macros?
Date: 16 Feb 1999 00:16:51
Message: <36c8ff43.0@news.povray.org>
I can use #error, #warning, etc. to output interesting text.  Is there any
way to include the location of the problem?

Something like:

    #if (foo>bar)
        #error concat ("Your object is impossible.  Stopped at ", __LINE__,
"\n")
   #end


Post a reply to this message

From: John VanSickle
Subject: Re: __FILE__ and __LINE__ equiv. in POV macros?
Date: 22 Feb 1999 20:23:22
Message: <36D20433.9BBBD359@erols.com>
John M. Dlugosz wrote:
> 
> I can use #error, #warning, etc. to output interesting text.  Is there any
> way to include the location of the problem?
> 
> Something like:
> 
>     #if (foo>bar)
>         #error concat ("Your object is impossible.  Stopped at ", __LINE__,
> "\n")
>    #end

Doesn't the #error directive already spit out the line number of the source?


Post a reply to this message

From: John M  Dlugosz
Subject: Re: __FILE__ and __LINE__ equiv. in POV macros?
Date: 23 Feb 1999 23:29:33
Message: <36d3802d.0@news.povray.org>
Yes it does -- bad example.  But #warning doesn't.

Better yet, I need a "caller".  For example, a macro that is configured with
symbols will spit out things like:

   #ifndef (Column_Flute_Mode)
      #declare Column_Flute_Mode= 1;  //if not specified, use Normal
      #warning "Column_Flute_Mode defaults to 1 (Normal)\n"
      #end

which is a handy way to tell the user of this macro about configuration
parameters he might not be aware of.  The __LINE__ would tell me where the
#warning was located, and from there figure out that it had to do with this
particular macro.  But a "caller", like in Perl, would tell me which
invocation of this macro is causing the noted effect.  E.g.

    archway (25, 14, 7)    // warning points to THIS line, generated by
archway macro,
      // saying that the middle parameter is not to its liking.

--John

John VanSickle wrote in message <36D20433.9BBBD359@erols.com>...
>John M. Dlugosz wrote:
>>
>> I can use #error, #warning, etc. to output interesting text.  Is there
any
>> way to include the location of the problem?
>>
>> Something like:
>>
>>     #if (foo>bar)
>>         #error concat ("Your object is impossible.  Stopped at ",
__LINE__,
>> "\n")
>>    #end
>
>Doesn't the #error directive already spit out the line number of the
source?


Post a reply to this message

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