make store and restore state combine with resetted variables

parent 7de7e8cc
......@@ -65,7 +65,7 @@ Version 0.6, TODO
* GC of multiple resetted variables PARTIAL
* persistant continuations
* persistant dynamical functions
* interpretter stores variables seen in stall's
* interpretter stores variables at stall DONE
* GC of the (almost) unreachable tail of a stream (all)
* Multi threading capabilities (all)
* Sandboxing (prolog)
......
......@@ -351,10 +351,10 @@
((f . l)
(cons (mk f)
(lp l (+ n 1))))))))
(<code>
(mac S 'prepend l2))
(<ret> ((mac S 'next)))))
(<with-s> (car state)
(<code>
(mac S 'prepend l2))
(<ret> ((mac S 'next))))))
(define (or-ii-f s x y p)
(let* ((state (gp-store-state s))
......@@ -374,8 +374,9 @@
(l2
(list (mk x) (mk y))))
(mac s 'prepend l2)
((mac s 'next))))
(<with-s> (car state)
(mac s 'prepend l2)
((mac s 'next)))))
(define-syntax-rule (get-depth)
......@@ -392,7 +393,8 @@
(gp-restore-wind
state (gp-rebased-level-ref wind))
(cc s p)))))
((mac s 'pre cc))))
(<with-s> (car state)
((mac s 'pre cc)))))
(define empty-schedule (vector '() '() '() #f))
......
......@@ -3605,6 +3605,7 @@ SCM_DEFINE(gp_lookup_1, "gp-lookup-1", 2, 0, 0, (SCM x, SCM s),
#include "indexer/indexer.c"
#include "attributed.c"
#include "matcher.c"
#include "guile-2.2.c"
void gp_init()
{
#include "unify.x"
......
......@@ -147,3 +147,5 @@ SCM_API SCM gp_lookup_1(SCM x, SCM s);
SCM_API SCM gp_get_taglist();
SCM_API SCM gp_match(SCM e, SCM run, SCM s);
SCM_API SCM gp_set_type_attribute(SCM x);
SCM_API SCM gp_find_elf_relative_adress(SCM ip);
......@@ -28,7 +28,10 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-9)
#:export (gp-member gp-right-of gp-einstein gp-next-to)
#:export
(gp-member gp-right-of gp-einstein gp-next-to
gp-store-state
)
#:re-export (gp-clear #;gp-newframe gp-heap-var!
;gp-unify! gp-unify-raw! gp-m-unify!
gp-car gp-cdr
......@@ -50,8 +53,7 @@
gp-get-stack
gp-module-init
gp-make-stack
gp-thread-safe-set!
gp-store-state
gp-thread-safe-set!
gp-undo-safe-variable-rguard
gp-undo-safe-variable-lguard
gp-undo-safe-variable-guard
......@@ -779,10 +781,8 @@
(define (gp-windlevel-ref s) (gp-lookup *windlevel* s))
(define gp-restore-wind gp-restore-state-raw)
(define (gp-restore-state x)
(gp-restore-state-raw x #t))
(gp-restore-state-raw (cdr x) #t))
(define (use-logical s)
(gp-dynwind
......@@ -1118,3 +1118,11 @@
(set! (@@ (ice-9 match-phd-lookup) gp-unwind ) gp-unwind )
(set! (@@ (ice-9 match-phd-lookup) gp-newframe) gp-newframe)
(define (gp-store-state s)
(let ((ss (gp-newframe s)))
(cons ss ((@@ (logic guile-log code-load) gp-store-state) ss))))
(define (gp-restore-wind state fr)
(gp-restore-wind-raw (cdr state) fr))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment