| Re: Save IDL Procedure Name [message #31949] |
Thu, 29 August 2002 09:15 |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
wen wrote:
> Hi,
>
> Does anyone know if there is a way to save an IDL procedure name as a
> variable? I would like to be able to use this name within my
> procedure.
>
> thanks,
> wen
Yes,
did you tried
help,call=call
in your routine
PRO test
HELP,call=call
PRINT,call
file=within_brackets(call[0],brackets=['<','('])
PRINT,file
fpe=file_path_name_ext(file)
PRINT,fpe.name
END
The result is for example
TEST </private/20020829/test.pro( 3)> $MAIN$
Now you can separate this by whithin_brackets
result is /private/20020829/test.pro
The separation of path, routine and extension is done by file_path_name_ext.
PRINT,fpe.name shows "test"
You need the following routines from our library:
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/within_brackets.tar.gz
or
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/within_brackets.sav
and
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/file_path_name_ext.tar.gz
or
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/file_path_name_ext.sav
(Remember a idl compiled file with the extension sav is automaticly
loaded the first time it is used.
This is the same behaviour as for idl sources (.pro).
They run on each idl platform with the same idl version (5.5))
For further routines and licensing please have a look at
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
|
|
|
|
| Re: Save IDL Procedure Name [message #31950 is a reply to message #31949] |
Thu, 29 August 2002 08:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wen (wku@qeallc.com) writes:
> Does anyone know if there is a way to save an IDL procedure name as a
> variable? I would like to be able to use this name within my
> procedure.
Humm, this may be a trick question. Let me try to
answer the question I think you are trying to ask.
Are you trying to do something like this:
**************************************************
PRO DrawIt, procedure, data,_Extra=extra
On_Error, 1
IF N_PARAMS() NE 2 THEN Message, 'Need two parameters.'
IF Size(procedure, /TName) NE 'STRING' THEN $
Message, 'First parameter must be a string.'
ok = Execute(procedure+ ', data, _Extra=extra')
IF NOT ok THEN Message, 'Procedure execution failed.'
END
*****************************************************
Then,
IDL> DrawIt, 'Surface', dist(30)
IDL> DrawIt, 'Contour', dist(30), NLevels=12, /Follow
IDL> DrawIt, 'Plot', Findgen(11)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|