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

Home » Public Forums » archive » Re: get variables name
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: get variables name [message #19547 is a reply to message #19535] Wed, 05 April 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
R.Bauer (R.Bauer@fz-juelich.de) writes:

> I like to know the name of a variable which is submitted as input to a
> procedure
>
> e.g
>
> pro test,var
> help,var
> end
>
> a=1
> test,a
>
> Is it possible to get inside test the information that test was called
> with a.

My life is totally out of control at the moment, so I haven't
had the opportunity to write this up for my web page, but
here is part of a correspondence I recently received from
Paul Woodford, an IDL user, concerning the undocumented
ROUTINE_NAMES function:

routine_names(variables=0) - variable names at current level
routine_names(variables=1) - variable names at main level
routine_names(variables=2) - variable names at one level down from main
routine_names(variables=-1) - variable names at one level up from current
routine_names(variables=-2) - variable names at two levels up from current

But wait, that's not all... Take a look at how routine_names is used in
gethelp - you can use routine_names to actually fetch a variable from a
different level. For instance, if you have a variable named 'blah' one
level up from your current level, you can get it using

blah_here = routine_names('blah', fetch=-1)

Now, I would add a STRONGLY worded caution here. This routine is
COMPLETELY undocumented. I suspect there is a reason for that.
When you write your program relying on this behavior, and RSI
changes it in the next release (which is their prerogative with
a COMPLETELY undocumented function), then I don't want to hear
any whining! :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: object graphics axis text
Next Topic: Re: pointer to structures

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

Current Time: Sat Oct 11 15:37:52 PDT 2025

Total time taken to generate the page: 0.39838 seconds