POV-Ray : Newsgroups : povray.general : Problem with Parse_String and #ifndef : Re: Problem with Parse_String and #ifndef Server Time
4 Aug 2024 00:26:36 EDT (-0400)
  Re: Problem with Parse_String and #ifndef  
From: Florian Brucker
Date: 10 Sep 2003 12:44:36
Message: <3f5f54f4$1@news.povray.org>
Hi Tim!

> You've got to experiment. Perhaps writing the entire
> #ifndef () ... #debug ".." #end
> to disc and #including that.
That did the job!

if anyone is interested, here's the code:

<code>
#include "strings.inc"

#declare TestIdent = 1;

#macro IFDEF2(Name)                                                   	
	#declare TEMPDEF__ = 0;

	Parse_String(concat(
		"#ifdef(",Name,")
			#declare TEMPDEF__=1;
		#end"
	))		
	
	(TEMPDEF__)
#end

#if (IFDEF2("TestIdent"))
	#debug "defined\n"
#else
	#debug "nope\n"
#end
</code>

result: defined

Thanks Tim!

Greetings,
Florian
-- 
//=================[web: http://www.torfbold.com]==================\\
#local a=-5;#while(a<5)sphere{<sin(a*pi)*5a*10pow(a,5)*.01>sin(a*a*a*
.1)+1pigment{rgb 9*z}}#local a=a+.01;#end camera{look_at-y*10location
<8,-3,-8>*10}// [www.povray.org]     [www.imp.org]     [www.irtc.org]


Post a reply to this message

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