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
|
|
|