postpone and better interactive stall behavior

parent 1d881dc4
......@@ -73,6 +73,7 @@ SOURCES = \
logic/guile-log/guile-prolog/fluid.scm \
logic/guile-log/guile-prolog/interpreter.scm \
logic/guile-log/guile-prolog/state.scm \
logic/guile-log/guile-prolog/postpone.scm \
language/prolog/spec.scm
AM_MAKEINFOFLAGS=--force
......
......@@ -219,7 +219,7 @@ HELP FOR PROLOG COMMANDS
(.cont | .c ) continue the execution from last stall point
(.lold | .lo) restore the last state at a stall
---------------------------------------------------------------------
(.ref ) <ref> get value of reference variable ref
(.ref ) <ref> get value of reference user variable ref
(.set ) <ref> <val> set user variable ref to value val
---------------------------------------------------------------------
......@@ -236,8 +236,10 @@ HELP FOR PROLOG COMMANDS
(lambda ()
((@@ (system repl command) meta-command) repl)))
(set! str "do[#f]"))
`(let ()
((@ (logic guile-log) <clear>))
`((@ (guile) let)
((fr ((@ (logic guile-log umatch) gp-newframe)
((@ (guile) fluid-ref)
(@ (logic guile-log umatch) *current-stack*)))))
((@@ (logic guile-log iso-prolog) prolog-run) 1 ()
((@@ (logic guile-log guile-prolog interpreter)
conversation1)
......@@ -249,7 +251,9 @@ HELP FOR PROLOG COMMANDS
'(@ (logic guile-log iso-prolog) false)))
,(if mute?
'(@ (logic guile-log iso-prolog) true)
'(@ (logic guile-log iso-prolog) false))))
'(@ (logic guile-log iso-prolog) false)))
((@ (logic guile-log) <code>)
((@ (logic guile-log umatch) gp-unwind) fr)))
(if #f #f))))
(else
l))))
......@@ -356,12 +360,12 @@ hash_new(X,Y,H,I) :-
output_and_more(Mute,V,N) :-
Mute == true -> more ;
(
(V==[] -> write('yes') ; (once(vtosym(V,VV)),write_out(VV,N),nl)), more
(V==[] -> write(\"yes\") ; (once(vtosym(V,VV)),write_out(VV,N),nl)), more
).
write_out([],[]).
write_out([V|Vs],[N|Ns])
:- nl,write(' '),write(N),write(' = '),write(V),
:- nl,write(\" \"),write(N),write(\" = \"),write(V),
write_out(Vs,Ns).
more :-
......@@ -373,12 +377,12 @@ more :-
integer(N) -> (N > 1 -> (do[(fluid-set! -nsol- (- (<lookup> N) 1))],
fail)
; throw(finish)) ;
readline('more (y/n/a) > ',Ans),
readline(\"more (y/n/a) > \",Ans),
(
Ans == 'y' -> fail ;
Ans == 'n' -> throw(finish) ;
Ans == 'a' -> scm[(fluid-set! -all- true)]==1 ;
write(' wrong input'),nl,more
Ans == \"y\" -> fail ;
Ans == \"n\" -> throw(finish) ;
Ans == \"a\" -> scm[(fluid-set! -all- true)]==1 ;
write(\" wrong input\"),nl,more
)
)
).
......
(define-module (logic guile-log guile-prolog postpone)
#:use-module (logic guile-log)
#:use-module (logic guile-log postpone)
#:re-export (postpone)
#:export (postpone_frame))
(<define> (postpone_frame . x) (<apply> postpone-frame x))
......@@ -199,7 +199,7 @@
(if (< (gp-lookup v ss) (fluid-ref *limit*))
(if (< (fluid-ref *n*) (fluid-ref *max-limit*))
(cc ss p)
(let* ((l (trim (fluid-ref *conts)
(let* ((l (trim (fluid-ref *conts*)
(/ (fluid-ref *max-limit*) 2))))
(do-gc)
(rs ss *conts* l (/ (fluid-ref *max-limit*) 2))
......
......@@ -3,8 +3,10 @@
#:use-module ((logic guile-log)
#:select (<define> <lookup> <scm> <=> <code> <wrap>))
#:use-module (logic guile-log umatch)
#:use-module (logic guile-log prolog error)
#:use-module (logic guile-log prolog closed)
#:use-module (logic guile-log prolog names)
#:use-module (logic guile-log dynamic-features)
#:use-module (ice-9 match)
#:use-module (ice-9 pretty-print)
#:re-export ( make-namespace
......@@ -106,7 +108,7 @@ Two things will happen
(<=> x ,(fluid-ref white-list-namespaces)))
(<define> (namespace_white_list_set x)
(<code> (fluid-set! white-list-namespaces (<scm> x))))
(define namespace_switch #f)
(mk-sym namespace_switch)
(define (err x) (<wrap> permission_error namespace_swich true x))
......
......@@ -10,6 +10,7 @@
(define (<stall> s p cc)
(gp-var-set *cc* (cons s (cons p cc)) s)
(fluid-set! *current-stack* s)
'stalled)
(define (<take> n) (<continue> n))
......
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