Ellipsis in IDL? [message #40122] |
Wed, 21 July 2004 15:58  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
How do you define a procedure to take N number of arguments when you
don't know what N is before the procedure call? For those of you who
have worked with C, what I'm after is something similar to the ellipsis
(...) which allows N many arguments to be specified for functions such
as printf.
In IDL, the print command is obvious example of what I'm trying to do.
The signature of print is:
print [, Expr1, Expr2, ... , ExprN]
So, how can I write a procedure to take N many arguments?
-Mike
|
|
|
Re: Ellipsis in IDL? [message #40259 is a reply to message #40122] |
Fri, 30 July 2004 17:25  |
Evan Fishbein
Messages: 4 Registered: May 1999
|
Junior Member |
|
|
I don't think I have used it with more than 30 arguments, but when you
write code to write code there is not limit to the size of the code
that can be written. I was curious if you could actually pass 1024
arguments to a routine without an exception or buffer overflow and you
can. By the way, I use this routine as part of some general routines
that create hdf files and excel spreadsheets which an undetermined at
compilation numbers of columns.
David Fanning wrote:
> Craig Markwardt writes:
>
>
>> Fascinating. I thought that the number of positional parameters was
>> limited to 64. That limit must have been lifted?
>
>
> Don't ask me. The largest number of positional parameters I've ever
> used is three. More than that, and my memory gets cloudy. :-(
>
> Cheers,
>
> David
|
|
|
Re: Ellipsis in IDL? [message #40266 is a reply to message #40122] |
Thu, 29 July 2004 21:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Craig Markwardt writes:
> Fascinating. I thought that the number of positional parameters was
> limited to 64. That limit must have been lifted?
Don't ask me. The largest number of positional parameters I've ever
used is three. More than that, and my memory gets cloudy. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Ellipsis in IDL? [message #40267 is a reply to message #40122] |
Thu, 29 July 2004 20:23  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Evan Fishbein <Evan.Fishbein@jpl.nasa.gov> writes:
> This is a multi-part message in MIME format.
> --------------000809020709000301000907
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
>
> About 1/2 year ago I asked RSI to include this capability. If enough
> people ask, I am sure they will comply. As for the suggestion about
> puttomh a list of arguments into a ptr array and using a case statement
> to processess the argument list I once wrote program that wrote a
> progam to put an argument list with up to 1024 arguments into a ptr
> array. It is attached.
Fascinating. I thought that the number of positional parameters was
limited to 64. That limit must have been lifted?
Craig
|
|
|
Re: Ellipsis in IDL? [message #40268 is a reply to message #40122] |
Thu, 29 July 2004 18:49  |
Evan Fishbein
Messages: 4 Registered: May 1999
|
Junior Member |
|
|
About 1/2 year ago I asked RSI to include this capability. If enough
people ask, I am sure they will comply. As for the suggestion about
puttomh a list of arguments into a ptr array and using a case statement
to processess the argument list I once wrote program that wrote a
progam to put an argument list with up to 1024 arguments into a ptr
array. It is attached.
Michael Wallace wrote:
> How do you define a procedure to take N number of arguments when you
> don't know what N is before the procedure call? For those of you who
> have worked with C, what I'm after is something similar to the ellipsis
> (...) which allows N many arguments to be specified for functions such
> as printf.
>
> In IDL, the print command is obvious example of what I'm trying to do.
> The signature of print is:
>
> print [, Expr1, Expr2, ... , ExprN]
>
> So, how can I write a procedure to take N many arguments?
>
> -Mike
|
|
|