Re: Accessing "main" level variables [message #18588] |
Wed, 19 January 2000 00:00  |
Michael Lefsky
Messages: 9 Registered: October 1999
|
Junior Member |
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Craig Markwardt wrote:
<p>>Incidentally, there is an internal IDL routine which *can* do this.
<br>>Unfortunately you need to write a DLM to access it.
<p>I haven't worked with the internal IDL routines, and don't
plan to. But I did look at the EDG documentation,
<br>and it seems like it would be relatively straighforward to write a
toolbox that would allow us (the IDL user community) to
access main level variables from within procedures. For instance, an IDL
shell could
<br>be written to access the routine
<p>
IDL_VPTR IDL_GetVarAddr(char *name)
<p>which would return the address of the variable, and then the variable
could be obtained and returned as the return value of the function.
<p>Has anyone written such a toolbox?
<br>
<p>Craig Markwardt wrote:
<blockquote TYPE=CITE>Michael Lefsky <lefsky@home.com> writes:
<p>> 2) Is it possible to access main level variables from within a procedure?
<br>> For instance, to solve the problem outlined in 1), you could simply
<br>> write a procedure called "save" which would have precedence over
the
<br>> system command save. However, once in the procedure "save", you would
no
<br>> longer have access to the main level variables that you want to save.
<br>> Even if you specified them as arguments to "save" you would no longer
<br>> have access to their original (ie. main level) names. There are numerous
<br>> applications for which I would like to be able to somehow get either
)
<br>> the names of the variables passed to the current procedure (ie. the
<br>> names they had at the level above them) or to access the main level
<br>> variables. Of course there might be numerous ways to do either of
these
<br>> things, from the ugly to the sublime- personally, I am not particular.
<p>I like your questino. I know I will get flamed for saying it,
but I
<br>think there are some times when it is desireable for a program to
<br>deposit its results into the main level. For example, a fully
canned
<br>curve fitting program may want to return the fitting results.
This
<br>should of course be done with full control and permission of the user.
<p>"Why," you ask, "don't you just return it as a regular or keyword
<br>parameter?"
<p>"Simple," I say. "You don't always know how many variables you
are
<br>going to return." Also, if it were a curve fitting program "for
<br>dummies" then I would want to make it as simple as possible.
<p>Incidentally, there is an internal IDL routine which *can* do this.
<br>Unfortunately you need to write a DLM to access it.
<p>Craig
<p>--
<br> ------------------------------------------------------------ --------------
<br>Craig B. Markwardt, Ph.D. & nbsp;
EMAIL: craigmnet@cow.physics.wisc.edu
<br>Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
<br> ------------------------------------------------------------ -------------- </blockquote>
<pre>--
Michael Lefsky, PhD
Research Ecologist
U.S. Forest Service
Forest Sciences Laboratory
Corvallis, OR
lefsky@fsl.orst.edu
<A HREF="http://www.fsl.orst.edu/~lefsky">http://www.fsl.orst.edu/~lefsky</A></pre>
</html>
|
|
|