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

Home » Public Forums » archive » Re: Passing optional parameters through a wrapper routine
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: Passing optional parameters through a wrapper routine [message #18839 is a reply to message #18830] Tue, 08 February 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kenneth P. Bowman (bowman@null.edu) writes:

> The _EXTRA keyword handles passing keyword parameters through a wrapper
> routine, but what about optional parameters?

_Extra (and _Ref_Extra, for that matter) apply only to *KEYWORD*
parameters. Positional parameters do not count.

> If my wrapper for TVRD has
> one of my own (mandatory) parameters, do I have to do the following?
>
> PRO TVRD_WRAPPER, my_arg, x0, y0, nx, ny, channel, _EXTRA = tvrd_keywords
>
> CASE N_PARAMS() OF
> 1 : image = TVRD( _EXTRA = tvrd_keywords)
> 2 : image = TVRD(x0, _EXTRA = tvrd_keywords)
> 3 : image = TVRD(x0, y0, _EXTRA = tvrd_keywords)
> 4 : image = TVRD(x0, y0, nx, _EXTRA = tvrd_keywords)
> 5 : image = TVRD(x0, y0, nx, _EXTRA = tvrd_keywords)
> 6 : image = TVRD(x0, y0, nx, ny, channel, _EXTRA = tvrd_keywords)
> ELSE : MESSAGE, 'Incorrect number of arguments.'
> ENDCASE
> ...

That's one way to do it. :-)

Another way is to define any parameter that is NOT passed
in. That might make more sense, since this is standard
operating procedure for any optional parameter.

IF N_Elements(y0) EQ 0 THEN y0 = 0
IF N_Elements(nx) EQ 0 THEN nx = 100
etc.

> (Is TVRD just counting the number of passed
> parameters and not checking to see if they are defined?)

Hard to know what TVRD is doing, but what *you*
better be doing is making sure any variable you
plan to use is defined. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Object recognition
Next Topic: call C routine on a Linux computer

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

Current Time: Thu Oct 09 16:12:04 PDT 2025

Total time taken to generate the page: 1.51823 seconds