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

Home » Public Forums » archive » IDL procedure and function names
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL procedure and function names [message #89235] Thu, 07 August 2014 08:41 Go to next message
cpaxson is currently offline  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 #89236 is a reply to message #89235] Thu, 07 August 2014 08:53 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
Sorta.

Add this command your code:

MESSAGE, 'is starting', /CONTINUE, LEVEL=0

I use this from time to time - there's likely more sophisticated solutions out there.
Re: IDL procedure and function names [message #89237 is a reply to message #89235] Thu, 07 August 2014 08:53 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  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 Go to previous messageGo to next message
cpaxson is currently offline  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 #89239 is a reply to message #89235] Thu, 07 August 2014 09:59 Go to previous messageGo to next message
John Correira is currently offline  John Correira
Messages: 25
Registered: August 2011
Junior Member
On 08/07/2014 11: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
>


In David's absence I'll make a plug for cgWhoAmI

http://www.idlcoyote.com/programs/cgwhoami.pro


John
Re: IDL procedure and function names [message #89240 is a reply to message #89238] Thu, 07 August 2014 10:56 Go to previous messageGo to next message
Bill Nel is currently offline  Bill Nel
Messages: 31
Registered: October 2010
Member
You can also parse the output of "help, /traceback, output=callstack". If you turn this parsing code into a function, say, RoutineName(), you'll need to parse callstack[1] -- callstack[0] will be "RoutineName".
Re: IDL procedure and function names [message #89241 is a reply to message #89235] Thu, 07 August 2014 17:37 Go to previous message
Michael Galloy is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Dirty resampling of irregularly spaced point data with GRID_INPUT
Next Topic: TS_SMOOTH function

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

Current Time: Wed Oct 08 11:35:06 PDT 2025

Total time taken to generate the page: 0.00685 seconds