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

Home » Public Forums » archive » What subprogram? What parameters and keywords?
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: What subprogram? What parameters and keywords? [message #85647 is a reply to message #85639] Fri, 23 August 2013 08:09 Go to previous messageGo to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den fredagen den 23:e augusti 2013 kl. 15:57:32 UTC+2 skrev Mats Löfdahl:
> Den fredagen den 23:e augusti 2013 kl. 14:52:28 UTC+2 skrev David Fanning:
>> Mats Löfdahl writes:
>
>>> Let's say IDL has just entered a subroutine or function. Is any of the following information available?
>
>>> 1. The name of the subprogram (like $0 in bash)
>>> 2. The parameters as an array or struct or similar (kind of like $*), preferably including keywords.
>
>> You can find two useful programs in the Coyote Library. WhoAmI returns
>> the name of the program module the WhoAmI program is called in, and
>> WhoCalledMe identifies the name of the program module that called the
>> routine you are now in.
>
>> There is no parameter stack that I am aware of, although it wouldn't
>> surprise me if the Scope_*** routines could figure it out.
>
> Thanks, that solves the first part of the problem! I'll read up on scope_*** and see if I can figure something out for the second part.

I didn't give much detail in my original post, but what I'm trying to do is make a subroutine that writes a log file with as much info as possible about the subprogram it was called from, without having been explicitly told very much. So David's WhoCalledMe is actually better than what I asked for.

And reading up on scope_*** and related routines was good advice, too. Looks like I could do something like this:

* Get the subprogram name from name=WhoCalledMe()
* Get the names of parameters and keywords from routine_info(name,/parameters)
* Get the level of the calling function from scope_level()-1
* Get the current values of the parameters and keywords from scope_varfetch

I haven't tried all the steps yet but it looks promising.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: operating on tab-/comma-delimited files
Next Topic: concatenating strings

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

Current Time: Fri Oct 10 07:47:39 PDT 2025

Total time taken to generate the page: 0.24172 seconds