correct off by 1 error in verify_attrs_interrupt, revert to previous lists.pl
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "scryer-prolog"
|
name = "scryer-prolog"
|
||||||
version = "0.8.106"
|
version = "0.8.107"
|
||||||
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
repository = "https://github.com/mthom/scryer-prolog"
|
repository = "https://github.com/mthom/scryer-prolog"
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ impl Line {
|
|||||||
&Line::Cut(_) => true,
|
&Line::Cut(_) => true,
|
||||||
&Line::Fact(_) => true,
|
&Line::Fact(_) => true,
|
||||||
&Line::Query(_) => true,
|
&Line::Query(_) => true,
|
||||||
&Line::Control(ControlInstruction::Proceed) => true,
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,58 +50,42 @@ reverse([], [], YsRev, YsRev).
|
|||||||
reverse([X1|Xs], [Y1|Ys], YsPreludeRev, Xss) :-
|
reverse([X1|Xs], [Y1|Ys], YsPreludeRev, Xss) :-
|
||||||
reverse(Xs, Ys, [Y1|YsPreludeRev], Xss).
|
reverse(Xs, Ys, [Y1|YsPreludeRev], Xss).
|
||||||
|
|
||||||
maplist_([], _).
|
maplist(_, []).
|
||||||
maplist_([E1|E1s], Cont) :-
|
maplist(Cont1, [E1|E1s]) :-
|
||||||
call(Cont, E1),
|
call(Cont1, E1),
|
||||||
maplist_(E1s, Cont).
|
maplist(Cont1, E1s).
|
||||||
|
|
||||||
maplist(Cont, Es) :- maplist_(Es, Cont).
|
maplist(_, [], []).
|
||||||
|
maplist(Cont2, [E1|E1s], [E2|E2s]) :-
|
||||||
|
call(Cont2, E1, E2),
|
||||||
|
maplist(Cont2, E1s, E2s).
|
||||||
|
|
||||||
maplist_([], _, []).
|
maplist(_, [], [], []).
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s]) :-
|
maplist(Cont3, [E1|E1s], [E2|E2s], [E3|E3s]) :-
|
||||||
call(Cont, E1, E2),
|
call(Cont3, E1, E2, E3),
|
||||||
maplist_(E1s, Cont, E2s).
|
maplist(Cont3, E1s, E2s, E3s).
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2) :- maplist_(Es1, Cont, Es2).
|
maplist(_, [], [], [], []).
|
||||||
|
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s]) :-
|
||||||
maplist_([], Cont, [], []).
|
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s], [E3|E3s]) :-
|
|
||||||
call(Cont, E1, E2, E3),
|
|
||||||
maplist_(E1s, Cont, E2s, E3s).
|
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2, Es3) :- maplist_(Es1, Cont, Es2, Es3).
|
|
||||||
|
|
||||||
maplist_([], _, [], [], []).
|
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s]) :-
|
|
||||||
call(Cont, E1, E2, E3, E4),
|
call(Cont, E1, E2, E3, E4),
|
||||||
maplist_(E1s, Cont, E2s, E3s, E4s).
|
maplist(Cont, E1s, E2s, E3s, E4s).
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2, Es3, Es4) :- maplist_(Es1, Cont, Es2, Es3, Es4).
|
maplist(_, [], [], [], [], []).
|
||||||
|
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s]) :-
|
||||||
maplist_([], _, [], [], [], []).
|
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s]) :-
|
|
||||||
call(Cont, E1, E2, E3, E4, E5),
|
call(Cont, E1, E2, E3, E4, E5),
|
||||||
maplist_(E1s, Cont, E2s, E3s, E4s, E5s).
|
maplist(Cont, E1s, E2s, E3s, E4s, E5s).
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2, Es3, Es4, Es5) :- maplist_(Es1, Cont, Es2, Es3, Es4, Es5).
|
maplist(_, [], [], [], [], [], []).
|
||||||
|
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s]) :-
|
||||||
maplist_([], _, [], [], [], [], []).
|
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s]) :-
|
|
||||||
call(Cont, E1, E2, E3, E4, E5, E6),
|
call(Cont, E1, E2, E3, E4, E5, E6),
|
||||||
maplist_(E1s, Cont, E2s, E3s, E4s, E5s, E6s).
|
maplist(Cont, E1s, E2s, E3s, E4s, E5s, E6s).
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2, Es3, Es4, Es5, Es6) :- maplist_(Es1, Cont, Es2, Es3, Es4, Es6, Es6).
|
maplist(_, [], [], [], [], [], [], []).
|
||||||
|
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s]) :-
|
||||||
maplist_([], _, [], [], [], [], [], []).
|
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s]) :-
|
|
||||||
call(Cont, E1, E2, E3, E4, E5, E6, E7),
|
call(Cont, E1, E2, E3, E4, E5, E6, E7),
|
||||||
maplist_(E1s, Cont, E2s, E3s, E4s, E5s, E6s, E7s).
|
maplist(Cont, E1s, E2s, E3s, E4s, E5s, E6s, E7s).
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2, Es3, Es4, Es5, Es6, Es7) :- maplist_(Es1, Cont, Es2, Es3, Es4, Es6, Es6, Es7).
|
maplist(_, [], [], [], [], [], [], [], []).
|
||||||
|
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s], [E8|E8s]) :-
|
||||||
maplist_([], _, [], [], [], [], [], [], []).
|
call(Cont, E1, E2, E3, E4, E5, E6, E7),
|
||||||
maplist_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s], [E8|E8s]) :-
|
maplist(Cont, E1s, E2s, E3s, E4s, E5s, E6s, E7s, E8s).
|
||||||
call(Cont, E1, E2, E3, E4, E5, E6, E7, E8),
|
|
||||||
maplist_(E1s, Cont, E2s, E3s, E4s, E5s, E6s, E7s, E8s).
|
|
||||||
|
|
||||||
maplist(Cont, Es1, Es2, Es3, Es4, Es5, Es6, Es7, Es8) :- maplist_(Es1, Cont, Es2, Es3, Es4, Es6, Es6, Es7, Es8).
|
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ impl Machine {
|
|||||||
|
|
||||||
fn throw_session_error(&mut self, err: SessionError, key: PredicateKey) {
|
fn throw_session_error(&mut self, err: SessionError, key: PredicateKey) {
|
||||||
let h = self.machine_st.heap.h;
|
let h = self.machine_st.heap.h;
|
||||||
|
|
||||||
let err = MachineError::session_error(h, err);
|
let err = MachineError::session_error(h, err);
|
||||||
let stub = MachineError::functor_stub(key.0, key.1);
|
let stub = MachineError::functor_stub(key.0, key.1);
|
||||||
let err = self.machine_st.error_form(err, stub);
|
let err = self.machine_st.error_form(err, stub);
|
||||||
@@ -600,7 +600,7 @@ impl Machine {
|
|||||||
self.machine_st.absorb_snapshot(snapshot);
|
self.machine_st.absorb_snapshot(snapshot);
|
||||||
self.machine_st.ball = ball;
|
self.machine_st.ball = ball;
|
||||||
|
|
||||||
let h = self.machine_st.heap.h;
|
let h = self.machine_st.heap.h;
|
||||||
let stub = self.machine_st.ball.copy_and_align(h);
|
let stub = self.machine_st.ball.copy_and_align(h);
|
||||||
|
|
||||||
self.machine_st.throw_exception(stub);
|
self.machine_st.throw_exception(stub);
|
||||||
@@ -1046,7 +1046,7 @@ impl MachineState {
|
|||||||
|
|
||||||
match self.p {
|
match self.p {
|
||||||
CodePtr::VerifyAttrInterrupt(_) => {
|
CodePtr::VerifyAttrInterrupt(_) => {
|
||||||
self.p = CodePtr::Local(self.attr_var_init.cp + 1);
|
self.p = CodePtr::Local(self.attr_var_init.cp);// + 1);
|
||||||
|
|
||||||
if !self.verify_attr_stepper(indices, policies, code_repo, prolog_stream) {
|
if !self.verify_attr_stepper(indices, policies, code_repo, prolog_stream) {
|
||||||
if self.fail {
|
if self.fail {
|
||||||
|
|||||||
@@ -1617,10 +1617,10 @@ impl MachineState {
|
|||||||
if let &Addr::Con(Constant::Usize(num_of_args)) = &self.and_stack[e][frame_len] {
|
if let &Addr::Con(Constant::Usize(num_of_args)) = &self.and_stack[e][frame_len] {
|
||||||
self.num_of_args = num_of_args;
|
self.num_of_args = num_of_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.p = CodePtr::Local(self.and_stack[e].interrupt_cp);
|
|
||||||
self.deallocate();
|
self.deallocate();
|
||||||
|
self.p = CodePtr::Local(self.and_stack[e].interrupt_cp);
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
&SystemClauseType::RestoreCutPolicy => {
|
&SystemClauseType::RestoreCutPolicy => {
|
||||||
|
|||||||
@@ -283,6 +283,21 @@ impl fmt::Display for SessionError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Line {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
&Line::Arithmetic(ref arith_instr) => write!(f, "{}", arith_instr),
|
||||||
|
&Line::Choice(ref choice_instr) => write!(f, "{}", choice_instr),
|
||||||
|
&Line::Control(ref control_instr) => write!(f, "{}", control_instr),
|
||||||
|
&Line::Cut(ref cut_instr) => write!(f, "{}", cut_instr),
|
||||||
|
&Line::Fact(ref fact_instr) => write!(f, "{}", fact_instr),
|
||||||
|
&Line::Indexing(ref indexing_instr) => write!(f, "{}", indexing_instr),
|
||||||
|
&Line::IndexedChoice(ref indexed_choice_instr) => write!(f, "{}", indexed_choice_instr),
|
||||||
|
&Line::Query(ref query_instr) => write!(f, "{}", query_instr),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Number {
|
impl fmt::Display for Number {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
|||||||
Reference in New Issue
Block a user