fix bug in clause emulator

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1234 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-01-15 05:21:36 +00:00
parent dcc4f3c46d
commit baf823eb5c
2 changed files with 28 additions and 6 deletions

View File

@ -11,8 +11,12 @@
* File: index.c *
* comments: Indexing a Prolog predicate *
* *
* Last rev: $Date: 2004-12-28 22:20:35 $,$Author: vsc $ *
* Last rev: $Date: 2005-01-15 05:21:36 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.112 2004/12/28 22:20:35 vsc
* some extra bug fixes for trail overflows: some cannot be recovered that easily,
* some can.
*
* Revision 1.111 2004/12/21 17:17:15 vsc
* miscounting of variable-only clauses in groups might lead to bug in indexing
* code.
@ -7791,11 +7795,11 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
jlbl = &(ipc->u.clll.l3);
ipc = ipc->u.clll.l3;
} else if (!IsVarTerm(t) && t != ipc->u.clll.c) {
jlbl = &(ipc->u.clll.l2);
ipc = ipc->u.clll.l2;
} else {
jlbl = &(ipc->u.clll.l1);
ipc = ipc->u.clll.l1;
} else {
jlbl = &(ipc->u.clll.l2);
ipc = ipc->u.clll.l2;
}
break;
/* instructions type ollll */

View File

@ -38,7 +38,12 @@
check_if_vel_done(Var) :-
get_atts(Var, [size(_)]), !.
vel(LVs,Vs0,AllDiffs) :-
vel(LVs0,Vs0,AllDiffs) :-
get_rid_of_ev_vars(LVs0,LVs),
do_vel(LVs,Vs0,AllDiffs).
do_vel([],_,_) :- !.
do_vel(LVs,Vs0,AllDiffs) :-
check_for_hidden_vars(Vs0, Vs0, Vs1),
sort(Vs1,Vs),
find_all_clpbn_vars(Vs, LV0, LVi, Tables0),
@ -50,6 +55,17 @@ vel(LVs,Vs0,AllDiffs) :-
normalise(Ps0,Ps),
bind_vals(LVs,Ps,AllDiffs).
%
% some variables might already have evidence in the data-base.
%
get_rid_of_ev_vars([],[]).
get_rid_of_ev_vars([V|LVs0],LVs) :-
clpbn:get_atts(V, [evidence(_)]), !,
get_rid_of_ev_vars(LVs0,LVs).
get_rid_of_ev_vars([V|LVs0],[V|LVs]) :-
get_rid_of_ev_vars(LVs0,LVs).
find_all_clpbn_vars([], [], [], []) :- !.
find_all_clpbn_vars([V|Vs], [Var|LV], ProcessedVars, [table(I,Table,Deps,Sizes)|Tables]) :-
var_with_deps(V, Table, Deps, Sizes, Ev, Vals), !,
@ -370,8 +386,10 @@ divide_by_sum([P|Ps0],Sum,[PN|Ps]) :-
% what is actually output
%
attribute_goal(V, G) :-
get_atts(V, [posterior(Vs,Vals,Ps,AllDiffs)]),
get_atts(V, [posterior(Vs,Vals,Ps,AllDiffs)]), !,
massage_out(Vs, Vals, Ps, G, AllDiffs).
attribute_goal(V, true) :-
get_atts(V, [evidence(Ev)]), Ev = V.
massage_out(Vs, [D], [P], p(CEqs)=P, AllDiffs) :- !,
gen_eqs(Vs,D,Eqs),