send-and-run
restart
enable-trace
- disable-trace)
+ disable-trace
+ save-actors
+ save-actors-to
+ load-actors
+ load-actors-from)
(import scheme
(chicken base)
srfi-69
- matchable)
+ matchable
+ s11n)
(define trace-enabled #f) ;used for debugging
(define (restart)
(set! message-queue (make-fifo))
- (set! actor-table (make-hash-table))))
+ (set! actor-table (make-hash-table)))
+
+;;;
+;;; Serialization
+;;;
+
+ (define (save-actors-to filename)
+ (with-output-to-file filename
+ (lambda ()
+ (serialize (hash-table->alist actor-table)))))
+
+ (define (save-actors)
+ (save-actors-to "image"))
+
+ (define (load-actors-from filename)
+ (set! actor-table
+ (alist->hash-table (with-input-from-file filename deserialize))))
+
+ (define (load-actors)
+ load-actors-from "image"))