IDL procedure and function names [message #89235] |
Thu, 07 August 2014 08:41  |
cpaxson
Messages: 2 Registered: August 2014
|
Junior Member |
|
|
Dear IDL Users,
I would like to print out the name of the procedure or function as the code executes. In C I'd add a line referring to argv[0]. Is there an equivalent in IDL such as argv or a !System variable? Thanks.
Charles
|
|
|
|
Re: IDL procedure and function names [message #89237 is a reply to message #89235] |
Thu, 07 August 2014 08:53   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
On 08/07/14 11:41, cpaxson@cfa.harvard.edu wrote:
> Dear IDL Users,
>
> I would like to print out the name of the procedure or function as
> the code executes. In C I'd add a line referring to argv[0]. Is
> there an equivalent in IDL such as argv or a !System variable?
You can use the MESSAGE procedure, e.g.
pro testpro
message, 'Entered...', /informational
; do stuff
end
IDL> testpro
% TESTPRO: Entered...
IDL>
I use this in concert with a debug keyword, e.g.
pro testpro, debug=debug
if ( keyword_set(debug) ) then $
message, 'Entered...', /informational
; Do stuff
end
You can also pass an empty string.
cheers,
paulv
|
|
|
Re: IDL procedure and function names [message #89238 is a reply to message #89237] |
Thu, 07 August 2014 09:31   |
cpaxson
Messages: 2 Registered: August 2014
|
Junior Member |
|
|
On Thursday, August 7, 2014 11:53:29 AM UTC-4, Paul van Delst wrote:
> On 08/07/14 11:41, cpaxson@cfa.harvard.edu wrote:
>
>> Dear IDL Users,
>
>>
>
>> I would like to print out the name of the procedure or function as
>
>> the code executes. In C I'd add a line referring to argv[0]. Is
>
>> there an equivalent in IDL such as argv or a !System variable?
>
>
>
> You can use the MESSAGE procedure, e.g.
>
>
>
> pro testpro
>
> message, 'Entered...', /informational
>
> ; do stuff
>
> end
>
>
>
> IDL> testpro
>
> % TESTPRO: Entered...
>
> IDL>
>
>
>
> I use this in concert with a debug keyword, e.g.
>
>
>
> pro testpro, debug=debug
>
> if ( keyword_set(debug) ) then $
>
> message, 'Entered...', /informational
>
> ; Do stuff
>
> end
>
>
>
> You can also pass an empty string.
>
>
>
> cheers,
>
>
>
> paulv
Thank you very much paul and phillip
|
|
|
|
|
Re: IDL procedure and function names [message #89241 is a reply to message #89235] |
Thu, 07 August 2014 17:37  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 8/7/14, 9:41 am, cpaxson@cfa.harvard.edu wrote:
> Dear IDL Users,
>
> I would like to print out the name of the procedure or function as
> the code executes. In C I'd add a line referring to argv[0]. Is
> there an equivalent in IDL such as argv or a !System variable?
> Thanks.
>
> Charles
>
SCOPE_TRACEBACK is the way to tell what routine you are in.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
|
|
|