返回上一个状态 [英] Go back to last state
问题描述
是否有办法返回到运行时的最后状态?简而言之,保存运行时并重新加载它.但是核心图像太大(我正在做一个小游戏:-),所以我想出了一个主意,保存了一些重要数据,并开始在特定的行上运行(也许还包括堆栈信息).
Is there a way to go back to last state of the runtime? In short, save the runtime and reload it. But the core image is too big (I'm making a small game :-), so I come up with an idea, save some important data, and start running at certain line (maybe also the stack info).
例如:
(defun save ()
_do-some-magic-to-save-the-state-and-then-exit_)
(defvar data (list 'a 'b 'c)) ; important data
(format t "Hello ")
(save)
(format t "World!~%")
下次,该软件可以在其停止的位置启动.
Next time, the software can start at the point where it stopped.
$ software
Hello $ software
Hello $ software --load saved_state
World!
但是我根本不知道如何在Common Lisp中做到这一点...有人可以给我一些想法吗?
But I don't know how to do this in Common Lisp at all... Could someone please give me some ideas?
推荐答案
其工作方式取决于Common Lisp实现.查阅手册:
How this works depends on the Common Lisp implementation. Consult the manual:
- Clozure Common Lisp -> Saving Applications
- SBCL -> Saving a Core Image
- LispWorks -> Save Image
CLISP -> Saving an Image
其他几种实现方式...
several other implementations ...
这篇关于返回上一个状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!