| Global variables and IDL [message #16744] |
Fri, 20 August 1999 00:00  |
Kristian Kjaer
Messages: 58 Registered: June 1998
|
Member |
|
|
A while back, (13 Apr 1999 00:00:00 GMT, but I only read it now)
David Fanning wrote: << Subject: Re: Global variables and IDL
<< So I might write a "preferences" file for the application
<< that each person who installs the application has to modify
<< for their site. One item might be the location of the
<< "data directory". On the PC, this might look like this:
<<
<< DEFSYSV, '!Data_Directory', 'E:\secret\data'
<<
<< The UNIX user would modify this line to this:
<<
<< DEFSYSV, '!Data_Directory', '/usr/people/bob/secret/data'
(For what it's worth:)
For this kind of static information (where are the data, how to
print, etc.) I wrote a function, platform.pro which is called
whenever a module needs the information:
host=platform()
Platform.pro creates (internally) a number of structures similar to
dos_online_prfile32={ $
online : 'TRUE' ,$
dataroot : 'p:\bw1\tascom\dat' ,$
localdataroot :'d:\bw1\tascom\dat' ,$
plotfile : 'd:\temp\plot.ps' ,$
plotcmd : 'start PRFILE32.exe /q d:\temp\plot.ps' ,$
retain : 1 $ ; used in window,retain=host.retain
}
linux_offline_lpr={... etc
By a call
getenv('IDL_PLATFORM') ; IDL_PLATFORM: Environment var. telling us
where we are running
platform.pro decides which structure to return.
Then, if the code has to run on a new machine, platform.pro
needs adding to, but when, as happens more often in this case,
updated code is ported to any 'old' machine, no local changes
are needed.
Kristian
|
|
|
|
|
|
|
|
| Re: Global variables [message #18852 is a reply to message #16744] |
Tue, 08 February 2000 00:00  |
Erik Hummel
Messages: 6 Registered: February 2000
|
Junior Member |
|
|
Thanks!
David Fanning wrote:
> Erik Hummel (erik.hummel@philips.com) writes:
>
>> On a PC with Windows NT and object programming I like to use global
>> constants. I
>> like to define for instance some integer constant without the use of
>> common
>> blocks (the common block always has to be repeated before the variables
>> can be used)
>> or system variable.
>> Is it possible to declare a global constant without the use of common
>> blocks?
>
> Try DEFSYSV.
>
> 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
--
-------------------------------------------------
Erik Hummel dr. E. Hummel
MR Image Handling Software
email: erik.hummel@best.ms.philips.com
Phone: +31 40 2763318
Fax: +31 40 2765644
Philips Medical Systems
Building QR1117, Veenpluis 6, 5684 PC Best
The Netherlands
===================================================
|
|
|
|
| Re: Global variables [message #18855 is a reply to message #16744] |
Tue, 08 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Erik Hummel (erik.hummel@philips.com) writes:
> On a PC with Windows NT and object programming I like to use global
> constants. I
> like to define for instance some integer constant without the use of
> common
> blocks (the common block always has to be repeated before the variables
> can be used)
> or system variable.
> Is it possible to declare a global constant without the use of common
> blocks?
Try DEFSYSV.
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
|
|
|
|