more exo fixes.

This commit is contained in:
Vitor Santos Costa 2013-04-29 16:19:43 -05:00
parent 72cc5bc317
commit c04f04d078
5 changed files with 21 additions and 5 deletions

View File

@ -381,6 +381,8 @@ Yap_ExoLookup(PredEntry *ap USES_REGS)
}
if (count) {
yamop *code = LOOKUP(i, arity, j0, LOCAL_ibnds);
if (code == FAILCODE)
return code;
if (i->is_udi)
return ((CEnterExoIndex)i->udi_first)(i PASS_REGS);
else return code;

View File

@ -90,7 +90,7 @@ compare(const BITS32 *ip, Int j USES_REGS) {
BITS32 *sorted0, *sorted;
/* be conservative */
sz = sizeof(BITS32)*(it->ntrys+it->nentries);
sz = sizeof(BITS32)*(2*it->ntrys+it->nentries);
/* allocate space */
if (!(it->udi_data = malloc(sz)))
return;

View File

@ -176,7 +176,8 @@ typedef struct index_t {
BITS32 *links;
size_t size;
yamop *code;
void *udi_data, *udi_first, *udi_next;
BITS32 *udi_data;
void *udi_first, *udi_next;
UInt udi_arg;
} Index_t;

View File

@ -9095,11 +9095,11 @@ This package assumes you use UDI exo-indexing, that is:
@end example
It is designed to optimise the following type of queries:
@example
?- max(X, diagnoses(X, 9, Y)).
?- max(X, diagnoses(X, 9, Y), X).
?- min(X, diagnoses(X, 9, 36211117)).
?- min(X, diagnoses(X, 9, 36211117), X).
?- X #< Y, min(X, diagnoses(9, X, 36211117)), diagnoses(Y, 9, _).
?- X #< Y, min(X, diagnoses(X, 9, 36211117), X ), diagnoses(Y, 9, _).
@end example
The first argument gives the time, the second the patient, and the
third the condition code. The first query should find the last time

View File

@ -89,6 +89,19 @@ X #=< Y :-
X =< Y
).
X #= Y :-
( var(X) -> insert_atts(X, i(Y-1,Y+1,_))
;
( var(Y) -> insert_atts(Y, i(X-1,X+1,_) ) ;
true
)
;
var(Y) -> insert_atts(Y, i(X-1,X+Y,_))
;
X =:= Y
).
attribute_goals(X) -->
{ get_attr(X, exo_interval, Op) },
( { Op = max } -> [max(X)] ;