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

Home » Public Forums » archive » Re: Procedures with variable/dynamic argument list??
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: Procedures with variable/dynamic argument list?? [message #73089 is a reply to message #73084] Fri, 22 October 2010 06:56 Go to previous messageGo to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<d5d024b5-fb3e-438e-9277-c4dc032c35e2@n24g2000prj.googlegroups.com>,
SonicKenking <ywangd@gmail.com> wrote:

> Is it possible in IDL to code a procedure using variable/dynamic
> argument list?? i.e. the number of arguments is arbitrary and the
> procedure is able to accept them all with some argument array?
>
> Similar to the "va_list" in C or "*args" in Python.
>
> The Print command in IDL is a good example too for accepting arbitrary
> number of arguments and print them all. Unfortunately, the Print
> command is not written in IDL, hence no sneak peek of the source code
> ~~

IDL procedures and functions are flexible about how many
arguments you provide, as long as you don't pass too many.

You do have to provide at least as many dummy arguments
in the procedure definition as you intend to use. That is

PRO VAR_ARGS, a1, a2, a3, a4

can be called as

VAR_ARGS, x, y

It is up to the procedure to know what to do in that
case. (See the N_PARAMS function.)

As far as I know, there is no direct mechanism for
handling an arbitrary number of arguments other than
making a list in the procedure/function definition.

Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDLdoc 3.3 released
Next Topic: Re: the "real" screen size

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

Current Time: Wed Oct 08 19:59:08 PDT 2025

Total time taken to generate the page: 0.00399 seconds