RESTORE provides a very simple interface that restores the entire contents of the specified SAVE file in a single atomic operation. If you wish to query the contents of a SAVE file without first restoring the data, or if you wish to restore only selected items, use the interface provided by the IDL_Savefile object class instead.
Note: While files containing IDL data variables can be restored by any version of IDL that supports those data types, files containing IDL routines and system variables can only be restored by the same or later versions of IDL. Therefore, you should always archive your IDL language source files (.PRO files) in case you need to recompile your code in an earlier version of IDL. See Version Compatibility of SAVE Files for details.
Tip: Beginning with IDL 7.1, double-clicking on a SAVE file that has the extension .sav and contains IDL variables will automatically start the IDL Workbench (if it is not already running) and restore the contained variables. Double-clicking on SAVE files that contain routines (again, with the .sav extension) will execute the contained routines in IDL, launching IDL in Virtual Machine mode if it is not already running.
Suppose that you have saved all the variables from a previous IDL session with the command:
SAVE, /VARIABLES, FILENAME = 'session1.sav'
If the file session1.sav is located in your current working directory, the variable associated with the file can be restored by entering:
Note: To restore a file that is not in your current working directory, you must specify the file path.
A scalar string that contains the name of the SAVE file to be restored. If Filename is not an absolute path name, it is considered to be relative to the current working directory. If neither the Filename argument or the FILENAME keyword are present, IDL attempts to restore a file named idlsave.dat in the current working directory.
Set this keyword equal to a named variable that will contain the user-supplied description string for the specified save file. If no description was provided when the save file was created (via the DESCRIPTION keyword to the SAVEroutine), the variable specified by this keyword will contain an empty string.
By default, when RESTORE encounters a structure variable or object reference, it automatically attempts to find a corresponding __define file (a .PRO or .SAV file in IDL’s path that contains the corresponding structure or class definition). If IDL finds a __define file, it compiles it automatically, before restoring the variable or object reference. Set the NO_COMPILE keyword to disable this automatic compilation behavior.
Automatic compilation of structure definitions is useful for object class definitions if you have defined the object methods within the same .PRO or .SAV file — compiling the __define file will also compile the class methods and make them available to the newly-restored variables.
Automatic compilation is also useful if the structure or class definition has changed since the SAVE file was created. Compiling the __define file will ensure that IDL caches the new structure definition first, before the variable is restored.
Note: If the structure or class definition has changed since the SAVE file was created, you should also set the RELAXED_STRUCTURE_ASSIGNMENT keyword.
This keyword is ignored for SAVE files that contain code.
This keyword serves exactly the same purpose as the Filename argument—only one of them needs to be provided. If both the Filename argument and the FILENAME keyword are provided, the file specified by the Filename argument is restored.
Normally, RESTORE is unable to restore a structure variable if the definition of its type has changed since the SAVE file was written. A common case where this occurs is when objects are saved and the class structure of the objects change before they are restored in another IDL session. In such cases, RESTORE issues an error, skips the structure, and continues restoring the remainder of the SAVE file.
Setting the RELAXED_STRUCTURE_ASSIGNMENT keyword causes RESTORE to restore such incompatible values using “relaxed structure assignment,” in which all possible data are restored using a field-by-field copy. (See the description of the STRUCT_ASSIGN procedure for additional details.)
Set this keyword equal to a named variable that will contain an array of object references for any objects restored. The resulting list of objects is useful for programmatically calling the objects’ restore methods. If no objects are restored, the variable will contain a null object reference.
Set this keyword to have IDL print an informative message for each restored object.
Added DESCRIPTION keyword
Added automatic compilation when a structure variable or object reference has a corresponding _define file. Must use NO_COMPILE keyword to disable this automatic behavior.
Added NO_COMPILE keyword