Go to the previous, next section.
If for some reason you want to stop a SM session for later
resumption, and simply suspending the process, `^Z', is not
sufficient, (for instance the machine is going down), then the SAVE
command will write a file containing all your currently defined
macros, variables, and vectors, along with your current history buffer
as the macro all
. You will be prompted before each class of
objects is saved, or you can put the answers on the command line.
The file is ascii, and can be edited if you so
desire. The filename defaults to `sm.dmp' if not specified, or to
the value of save_file
from your `.sm' file.
If some bug has crawled unbeknownst to us into SM, and results
in some sort of panic (such as a segmentation violation), a save file
called `panic.dmp' is written to your temporary directory, no
questions asked.
To restart, RESTORE filename
will read them all back, using the
same default file as for SAVE
if no filename is specified, and
replace the current history buffer with the value of all
from the savefile. Of course, you could write a macro to preserve the
current buffer (see the definition of edit_all
for hints).
If the file wasn't written by SAVE
it is assumed to be a
SM history file, one of those written when you quit SM, and
each line is assumed to be a command and written to the end of the
history buffer. This is generally useful when you started SM
in the wrong directory. It wouldn't be hard to write a macro to use
RESTORE
to read a history file into a macro.
One problem with SAVE
is that it saves lots of macros,
including some of the system ones. Specifically, all macros are saved
except those beginning with "##".
This can be avoided with
the MACRO DELETE filename
command, e.g. MACRO DELETE utils
SAVE 1 1 1 MACRO READ utils
.
The macro sav
discussed under `useful macros' will do this for
you, and indeed not SAVE
any macros that have been read with the
load
macro. This is probably the best way to use the SAVE
command. In addition, sav
also decides to save variables and
macros, only prompting you about saving vectors. sav
is a good
candidate for overloading (as save
), and indeed is one of the
macros redefined by the set_overload
command.
Go to the previous, next section.