Saving and Restoring PV-WAVE Sessions
You can enter the SAVE and RESTORE commands at the WAVE> prompt. These functions are used to save and later restore the state of user-generated variables, system variables, and compiled procedures and functions.
This ability to “checkpoint” a session and then recover it later can be very convenient. Save files can be used for many purposes:
-
Save files can be used to recover variables that are used from session to session. A startup file can be used to execute the RESTORE command every time PV‑WAVE is started. See the discussion of startup files in Modifying Your Environment in the PV‑WAVE Programmer’s Guide.
-
The state of a PV‑WAVE session can be saved, then quickly restored to the same point, allowing you to stop working, and then later resume at a convenient time.
-
Saved files relieve you of the need to remember the dimensions of arrays and other details. It is very convenient to store images this way. For example, if the three variables
R,G, andBhold the color table vectors, and the variableImageholds the image data, the PV‑WAVE statement: -
Long iterative jobs can save partial results in save/restore format to guard against losing data if some unexpected event such as a machine crash were to occur.
SAVE, Filename='image.dat', R, G, B, Image
saves everything required to display the image properly in a file named image.dat. At a later time, the command:
RESTORE, 'image.dat'
will restore the four variables from the file.
Using the RESTORE Procedure
The RESTORE command restores the objects previously saved in a save file when you used the SAVE procedure at the WAVE> prompt.
If a filename is not supplied in the call to RESTORE, the filename wavesave.dat is used. In addition, you can use keywords with RESTORE.
Things to Remember when Restoring Files
Situations in which the contents of the file will not be restored are:
-
When attempting to restore a structure variable, the structure of the saved variable must either not exist, or must agree with the existing structure definition. If the structure is already defined and does not match, RESTORE issues an error message, skips the variable in question, and continues with the next variable in the file. This also applies to system variables.
-
Read-only system variables are not restored. RESTORE quietly skips over such variables in the file unless the Verbose keyword is present. In this case an informative message is issued as the variable is skipped.