SAVESYS and RESTSYS provide a simple method for saving and restoring the state of IDL system variables. Use of this routine pair will help programmers avoid global side effects within routines which change system variables. In general, the use of these routines should be done symmetrically within a given routine as the following example dummy code segment illustrates.
pro junk,a,b,c ; function or procedure definition
savesys,/aplot ; *** save plot variables with savesys.pro
<change !x,!y,!z,!p> ; code which changes IDL system variables
restsys,/aplot ; *** restore plot variables with restsys.pro
return
end
Another use of restsys.pro is to restore IDL system variables to the startup state to recover from routines which corrupted the system variables. IDL> restsys, /init, /all ; restore IDL system variables to startup state