correct off by 1 error in verify_attrs_interrupt, revert to previous lists.pl

This commit is contained in:
Mark Thom
2019-10-12 19:14:33 -06:00
parent 8c4c70b089
commit 1d41489381
6 changed files with 50 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "scryer-prolog"
version = "0.8.106"
version = "0.8.107"
authors = ["Mark Thom <markjordanthom@gmail.com>"]
build = "build.rs"
repository = "https://github.com/mthom/scryer-prolog"

View File

@@ -151,7 +151,6 @@ impl Line {
&Line::Cut(_) => true,
&Line::Fact(_) => true,
&Line::Query(_) => true,
&Line::Control(ControlInstruction::Proceed) => true,
_ => false,
}
}

View File

@@ -50,58 +50,42 @@ reverse([], [], YsRev, YsRev).
reverse([X1|Xs], [Y1|Ys], YsPreludeRev, Xss) :-
reverse(Xs, Ys, [Y1|YsPreludeRev], Xss).
maplist_([], _).
maplist_([E1|E1s], Cont) :-
call(Cont, E1),
maplist_(E1s, Cont).
maplist(_, []).
maplist(Cont1, [E1|E1s]) :-
call(Cont1, E1),
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_([E1|E1s], Cont, [E2|E2s]) :-
call(Cont, E1, E2),
maplist_(E1s, Cont, E2s).
maplist(_, [], [], []).
maplist(Cont3, [E1|E1s], [E2|E2s], [E3|E3s]) :-
call(Cont3, E1, E2, E3),
maplist(Cont3, E1s, E2s, E3s).
maplist(Cont, Es1, Es2) :- maplist_(Es1, Cont, Es2).
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]) :-
maplist(_, [], [], [], []).
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s]) :-
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_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s]) :-
maplist(_, [], [], [], [], []).
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s]) :-
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_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s]) :-
maplist(_, [], [], [], [], [], []).
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s]) :-
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_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s]) :-
maplist(_, [], [], [], [], [], [], []).
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s]) :-
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_([E1|E1s], Cont, [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s], [E8|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).
maplist(_, [], [], [], [], [], [], [], []).
maplist(Cont, [E1|E1s], [E2|E2s], [E3|E3s], [E4|E4s], [E5|E5s], [E6|E6s], [E7|E7s], [E8|E8s]) :-
call(Cont, E1, E2, E3, E4, E5, E6, E7),
maplist(Cont, E1s, E2s, E3s, E4s, E5s, E6s, E7s, E8s).

View File

@@ -383,7 +383,7 @@ impl Machine {
fn throw_session_error(&mut self, err: SessionError, key: PredicateKey) {
let h = self.machine_st.heap.h;
let err = MachineError::session_error(h, err);
let stub = MachineError::functor_stub(key.0, key.1);
let err = self.machine_st.error_form(err, stub);
@@ -600,7 +600,7 @@ impl Machine {
self.machine_st.absorb_snapshot(snapshot);
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);
self.machine_st.throw_exception(stub);
@@ -1046,7 +1046,7 @@ impl MachineState {
match self.p {
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.fail {

View File

@@ -1617,10 +1617,10 @@ impl MachineState {
if let &Addr::Con(Constant::Usize(num_of_args)) = &self.and_stack[e][frame_len] {
self.num_of_args = num_of_args;
}
self.p = CodePtr::Local(self.and_stack[e].interrupt_cp);
self.deallocate();
self.p = CodePtr::Local(self.and_stack[e].interrupt_cp);
return Ok(());
}
&SystemClauseType::RestoreCutPolicy => {

View File

@@ -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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {