RE: passing string parameter [message #7207] |
Sun, 20 October 1996 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
George McCabe <george@replica.gsfc.nasa.gov> writes:
> I want to write a small help procedure to display brief summaries
> of home made commands.
> IDL> helpme, command_name_string
> Is there a way to pass command_name_string to the procedure helpme
> without quotes?
If I understand this question correctly, I think you want to be able
to say:
HELPME, myCommand
And have your HELPME procedure interrpret "myCommand" as a string.
I can't think of any way to do this.
But I am sensitive to the problem. Let me suggest an alternative
approach. I define a HELP keyword for all my programs, so that
if I can't remember how to use them, I call them with the HELP
keyword set. If the HELP keyword is set, they print out a short
helpful message about how to use the program and return. Here
is an example of a little program named DOIT:
PRO DOIT, data, HELP=help
IF KEYWORD_SET(help) THEN BEGIN
PRINT, 'DOIT, data'
RETURN
ENDIF
PLOT, data
END
I picked up this little trick from Ray Sterner at Johns Hopkins
Applied Physics Lab, an excellent IDL programmer who always
writes programs that are *fully* documented.
Yours,
David
--
David Fanning, Ph.D.
Phone: 970-221-0438
Fax: 970-221-4728
E-Mail: davidf@fortnet.org
|
|
|