POV-Ray : Newsgroups : povray.beta-test : Syntax extension: Passing multiple values out of a macro : Re: Syntax extension: Passing multiple values out of a macro Server Time
28 Apr 2024 11:10:48 EDT (-0400)
  Re: Syntax extension: Passing multiple values out of a macro  
From: clipka
Date: 1 Mar 2015 13:12:38
Message: <54f35696@news.povray.org>
Am 01.03.2015 um 09:27 schrieb Thomas de Groot:
> On 1-3-2015 2:51, clipka wrote:
>> I've just implemented a syntax extension that you might like: As of the
>> newest development version, you'll now be able to assign multiple
>> variables with a single #declare (or #local) statement, like so:
>>
>>    #declare (A,B,C) = (X,Y,Z);
>>
>> Obviously, this now allows for a single macro to return multiple items,
>> like this:

Sorry, forgot some part of the code (I guess I was a bit tired):

>>
>>    #macro WindowFrameAndCutout(Pos,H,W)
>>      #local Frame  = union {...};
>>      #local Cutout = box {...};
         #local Area   = H*W;
>>      (Frame,Cutout,Area)
>>    #end
>>
>>    #declare (MyFrame,MyCutout) = WindowFrameAndCutout(...);
       #declare (MyFrame,MyCutout,MyArea) = ...
>>
>> How's that? :D
>
> Probably neat, but I confess I do not really understand the example and
> what it does...

Suppose you have a set of macros to generate architecture; in such a 
framework, for windows you'll want both the windows itself, as well as a 
shape to cut a matching hole into the wall. And for some reason you 
might also be interested in knowing the area of the window, though I 
confess I just put it in there just to demonstrate that you can return 
values of different types.


Post a reply to this message

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