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

Home » Public Forums » archive » defsysv
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
defsysv [message #7777] Wed, 15 January 1997 00:00 Go to next message
Jeff Hall is currently offline  Jeff Hall
Messages: 7
Registered: September 1996
Junior Member
Why does this work on the command line

IDL> '!jeff', 38
IDL> print, !jeff

when this doesn't work as a pro?

pro test
defsysv, '!jeff', 38
print, !jeff
end

Were are trying to utilize a user-defined
system variable to contain a handle value,
but there is this problem of being able to
define the system variable inside the
application. So far, we can only get it
to work on the command line, although after
the system variable has been defined on the
command line then the application works fine.
How do you use "defsysv" in a program?

Jeff
Re: defsysv [message #7898 is a reply to message #7777] Fri, 17 January 1997 00:00 Go to previous message
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On Wed, 15 Jan 1997, Jeff Hall wrote:
> Why does this work on the command line
>
> IDL> defsysv, '!jeff', 38
> IDL> print, !jeff
>
> when this doesn't work as a pro?
>
> pro test
> defsysv, '!jeff', 38
> print, !jeff
> end

I think this comes down to another strange "feature" in the IDL compiler:
It seems that IDL recognises system variables at COMPILATION time.
In your routine, !jeff is undefined at compilation time; this is
detected and IDL stops with an error message on the line "print, !jeff".
(!jeff only gets defined at runtime.)

A sort-of way out is to have a routine which defines system variables but
doesn't do anything else with them, and call it before any routine which uses
these system variables is compiled.
More simply, define all of your custom system variables at IDL startup (e.g.,
in a startup file). Then you can reassign their values in your programs
(e.g., !jeff=38).


Peter Mason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL 4.0.1 - Windows NT 4.0
Next Topic: calling a user-named procedure

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

Current Time: Wed Oct 08 11:30:19 PDT 2025

Total time taken to generate the page: 0.00413 seconds