Next: ref-sls-ssl, Previous: ref-sls-ove, Up: ref-sls [Contents][Index]
saved states are just a special case of PO files. The
save_program/[1,2]
predicate will save the execution state in a
file. The state consists of all predicates and modules except built-in
predicates and clauses of volatile predicates, the current operator
declarations, the current character-conversion mapping, the values of
all writable Prolog flags except those marked as volatile in
ref-lps-flg, any blackboard data (see ref-mdb-bbd), database
data (see ref-mdb-bas), and as of release 4.2, information for
source-linked debugging.
See mpg-ref-save_program.
A saved state, can be restored using the restore/1
predicate from within Prolog:
| ?- restore(File).
which will replace the current program state by the one in File. See mpg-ref-restore.
A saved state can also be given as an option to the sicstus
command:
% sicstus -r File
which will start execution by restoring File.
The location (i.e. directory) of the saved state, when it is created
with save_program/[1,2]
and loaded with restore/1
, is
treated in a special way in order to make it possible locate files when
the saved state has been moved. See Saving for more information.
The save_program/2
predicate can be used to specify an initial goal
that will be run when the saved state is restored. For example:
| ?- save_program(saved_state,initial_goal([a,b,c])).
When saved_state is loaded initial_goal/1
will be called. This allows
saved states to be generated that will immediately start running the user’s
program when they are restored. In addition to this save_program/2
facility, see also the initialization/1
facility to declare
goal to be executed upon loading (see Initializations).