comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Looping over parameters without EXECUTE()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Looping over parameters without EXECUTE() [message #43937 is a reply to message #43804] Tue, 03 May 2005 10:41 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Tue, 03 May 2005 15:43:33 +0200, Thomas Pfaff wrote:

>
>
> JD Smith schrieb:
>> On Mon, 02 May 2005 12:10:43 -0400, Wayne Landsman wrote:
>>
>>
>>> The one case where I haven't figured out how to remove EXECUTE() from a
>>> program (to allow use with the Virtual Machine) is where one wants to
>>> loop over supplied parameters. For example, to apply the procedure
>>> 'myproc' to each supplied parameter (which may have different data
>>> types) one can use EXECUTE() to write each parameter to a temporary
>>> variable:

>
> How about putting all those parameters into a (named or anonymous)
> struct? Then you can have different types for each parameter and you're
> still able to loop over the elements.
>
> pro doit, param_struct
> for i=0, n_tags(param_struct) -1 do begin
> arg = param_struct.(i) ;->this way you can even store result values
> myproc, arg
> param_struct.(i) = arg
> endfor
> end
>
> Would that be a possibility, or am I missing something?

That works OK, and if you used TEMPORARY() you could cut down the data
copying penalty. There are two main problems with this approach: 1) the
user has to create a potentially large struct as input and then unpack it
as output, which is not convenient from the command line, especially for
output arguments, and 2) the type and size of each argument cannot be
changed, thanks to the nature of structs.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Adding flexibility at run time question
Next Topic: Re: Adding flexibility at run time question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 02:32:41 PDT 2025

Total time taken to generate the page: 0.95473 seconds