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

Home » Public Forums » archive » Re: Function to return the current procedure/function
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: Function to return the current procedure/function [message #67922 is a reply to message #67920] Sat, 05 September 2009 07:04 Go to previous messageGo to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Sat, 5 Sep 2009 07:05:31 -0600, David Fanning wrote:

> maurya writes:
>
>> Is there any function to return the current procedure/function name
>> only not all?
>>
>> There is one function "ROUTINE_INFO" which provide information about
>> all currently-compiled procedures and functions. But, I want to get
>> the name of the procedure/function using a function (say Routine_Name)
>> by calling in the same routine. e.g.
>>
>> Pro test_plot
>>
>> plot,findgen(200)
>> ;
>>
>> print, Routine_Name()
>>
>> end
>>
>> The print function should return 'test_plot'.
>
> ProgramRootDir does this:
>
> http://www.dfanning.com/programs/programrootdir.pro
>
> Cheers,
>
> David

An alternative approach is the SCOPE_TRACEBACK function, which is part
of IDL:

IDL> info=scope_traceback(/structure)
IDL> n=n_elements(info)
IDL> help,info[n-1],/structure
** Structure IDL_TRACEBACK, 8 tags, length=36, data length=36:
ROUTINE STRING 'DISPLAY'
FILENAME STRING 'C:\my_routines\display.pro'
LINE LONG 99
LEVEL LONG 1
IS_FUNCTION BYTE 0
METHOD BYTE 0
RESTORED BYTE 0
SYSTEM BYTE 0
IDL> print,'Routine name is: '+info[n-1].routine
Routine name is: DISPLAY

Heinz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Readu, Writeu Causing Segmentation Fault
Next Topic: Re: Help, no improvement in FFT speed on a multiprocessor system

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

Current Time: Fri Oct 10 15:31:55 PDT 2025

Total time taken to generate the page: 1.19635 seconds