POV-Ray : Newsgroups : povray.general : Request for enhancement : Re: Request for enhancement Server Time
8 Aug 2024 20:23:05 EDT (-0400)
  Re: Request for enhancement  
From: Chris Colefax
Date: 4 Dec 2000 18:35:37
Message: <3a2c2a49@news.povray.org>
Chris Huff <chr### [at] maccom> wrote:
> Because you can't do this with macros? :-)
> The #set directive works with both #declare and #local, and will be
> faster than calling a macro, not to mention looking better in the scene
> code...

#macro Macro()
   #local X = 6;
   #debug concat("X = ", str(X, 0, -1), "\n")

   assign (X, 5);
   #debug concat("X = ", str(X, 0, -1), "\n")
#end

#macro assign (Var, Value) #declare Var = Value #end

#declare X = 1;
#debug concat("X = ", str(X, 0, -1), "\n")

assign (X, 3);
#debug concat("X = ", str(X, 0, -1), "\n")

Macro()

#debug concat("X = ", str(X, 0, -1), "\n")

As expected, this returns X-values of 1 (declared), 3 (assigned), 6
(localed), 5 (assigned to local), and 3 again (globally assigned).  This
seems to work pretty well to me!  And it works fine with objects and other
variable types, and looks quite neat.  Speed shouldn't be a major issue, as
Bob seemed to want the function mostly as a debugging tool.  For final
distributable code, the assign's could easily be changed to #declare
statements.

It's not that I don't think POV-patches have their value - simply that one
of the real strengths of POV is its portability and accessibility, and doing
as much as possible to maintain this seems, to me at least,  preferable to
splintering POV-users into different groups based on
platforms/versions/whatever.


Post a reply to this message

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