implement less defaulty interface in cont.pl
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -312,6 +312,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "prolog_parser"
|
name = "prolog_parser"
|
||||||
version = "0.8.37"
|
version = "0.8.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lexical 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lexical 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-rug-adapter 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-rug-adapter 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -446,7 +447,7 @@ dependencies = [
|
|||||||
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-rug-adapter 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-rug-adapter 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"prolog_parser 0.8.37",
|
"prolog_parser 0.8.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rug 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rug 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustyline 5.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustyline 5.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -589,6 +590,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "443c53b3c3531dfcbfa499d8893944db78474ad7a1d87fa2d94d1a2231693ac6"
|
"checksum num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "443c53b3c3531dfcbfa499d8893944db78474ad7a1d87fa2d94d1a2231693ac6"
|
||||||
"checksum ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7eb5259643245d3f292c7a146b2df53bba24d7eab159410e648eb73dc164669d"
|
"checksum ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7eb5259643245d3f292c7a146b2df53bba24d7eab159410e648eb73dc164669d"
|
||||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
|
"checksum prolog_parser 0.8.37 (registry+https://github.com/rust-lang/crates.io-index)" = "cb3da90085db170f1045f7d6851da12400ab205af9ec2acaa5ee42ab45a25dd8"
|
||||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
|
|
||||||
:- module(cont, [reset/3, shift/1]).
|
:- module(cont, [reset/3, shift/1]).
|
||||||
|
|
||||||
reset(Goal, Cont, Term) :-
|
reset(Goal, Ball, Cont) :-
|
||||||
call(Goal),
|
call(Goal),
|
||||||
'$reset_cont_marker',
|
'$reset_cont_marker',
|
||||||
'$bind_from_register'(Cont, 3),
|
'$bind_from_register'(Cont, 3),
|
||||||
'$bind_from_register'(Term, 4).
|
'$bind_from_register'(Ball, 4).
|
||||||
|
|
||||||
shift(Term) :-
|
shift(Term) :-
|
||||||
'$nextEP'(first, E, P),
|
'$nextEP'(first, E, P),
|
||||||
get_chunks(E, P, L),
|
get_chunks(E, P, L),
|
||||||
Cont = cont(call_continuation(L)),
|
( L == [] ->
|
||||||
|
Cont = none
|
||||||
|
; Cont = cont(call_continuation(L))
|
||||||
|
),
|
||||||
'$write_cont_and_term'(_, _, Cont, Term),
|
'$write_cont_and_term'(_, _, Cont, Term),
|
||||||
'$unwind_environments'.
|
'$unwind_environments'.
|
||||||
|
|
||||||
|
|||||||
@@ -2197,8 +2197,12 @@ impl MachineState {
|
|||||||
self.reset_block(addr);
|
self.reset_block(addr);
|
||||||
}
|
}
|
||||||
&SystemClauseType::ResetContinuationMarker => {
|
&SystemClauseType::ResetContinuationMarker => {
|
||||||
self[temp_v!(3)] = Addr::Con(Constant::Integer(Integer::from(0)));
|
self[temp_v!(3)] = Addr::Con(Constant::Atom(clause_name!("none"), None));
|
||||||
self[temp_v!(4)] = Addr::Con(Constant::Integer(Integer::from(0)));
|
|
||||||
|
let h = self.heap.h;
|
||||||
|
self.heap.push(HeapCellValue::Addr(Addr::HeapCell(h)));
|
||||||
|
|
||||||
|
self[temp_v!(4)] = Addr::HeapCell(h);
|
||||||
}
|
}
|
||||||
&SystemClauseType::SetBall =>
|
&SystemClauseType::SetBall =>
|
||||||
self.set_ball(),
|
self.set_ball(),
|
||||||
|
|||||||
Reference in New Issue
Block a user