POV-Ray : Newsgroups : povray.bugreports : alpha.10064268 macro problem : Re: alpha.10064268 macro problem Server Time
19 Apr 2024 07:11:10 EDT (-0400)
  Re: alpha.10064268 macro problem  
From: Bald Eagle
Date: 3 Apr 2021 16:35:00
Message: <web.6068d0cd54e5aaba1f9dae3025979125@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> I've run into a problem which I cannot understand.  I'm working on a 'Foreach'
> macro, to process arrays.  it works as expected, except..

> File 'fore_demo.pov' line 199: Parse Error: Expected 'numeric expression',
>  sphere found instead


Because it is looking for a numeric expression that you somehow left out.

When I insert a line before the sphere and put "0", I get:

Possible Parse Error: Unmatched (
at File: foreach.inc Line: 344 Col: 11
Parse Error: No matching ), sphere found instead

But then curiously, when I put "0)" I get:

Parse Warning: Unbalanced ) in include file
Parse Warning: Unbalanced } in include file
Parse Error: Unbalanced #end directives in include file.


Other than that, you have too much clever stuff going on for me to follow.
Add in more debug statements to follow your code flow.

I added:

#macro fore_exec(s_)
  #local fn_ = "/tmp/parse_fore.tmp";
  #fopen fp_ fn_ write
  #write (fp_, s_)
  #fclose fp_
  #debug "fore_exec(s_).... \n" // BW
  #debug concat (s_, "\n")
  #include fn_
#end

#macro fore_call(a_,s_,f_)
  #if (f_)
    #local rtn_ = fore_exec(s_);
  #else
   #debug "fore_call 1.... \n" // BW
    fore_exec(s_)
    #local rtn_ = 1;
  #end
  #if (fore_debug)
    #debug concat("call '",s_,"' returned '",str(rtn_,0,0),"'.\n")
  #end
  #debug "fore_call 2.... \n" // BW
  rtn_
#end


and

#macro mkSphere (p_, d_, c_)
 #debug "executing mkSphere... \n"
 0)
  sphere {
    p_, d_
    pigment {colours_[c_]}
  }
#end


Post a reply to this message

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