avoid repeated discontiguous messages

This commit is contained in:
Vitor Santos Costa 2016-05-16 09:35:29 +01:00
parent 87e13a9730
commit 9f2ba2d4fb
3 changed files with 17 additions and 3 deletions

View File

@ -1485,11 +1485,21 @@ bool Yap_discontiguous(PredEntry *ap, Term mode USES_REGS) {
return false; return false;
} }
if (ap == LOCAL_LastAssertedPred) if (ap == LOCAL_LastAssertedPred)
return FALSE; return false;
if (ap->cs.p_code.NOfClauses) { if (ap->cs.p_code.NOfClauses) {
Term repeat = AbsPair((CELL *)AbsPredProp(ap));
for (fp = LOCAL_ConsultSp; fp < LOCAL_ConsultBase; ++fp) for (fp = LOCAL_ConsultSp; fp < LOCAL_ConsultBase; ++fp)
if (fp->p == AbsPredProp(ap)) if (fp->p == AbsPredProp(ap)) {
// detect repeated warnings
if (LOCAL_ConsultSp == LOCAL_ConsultLow + 1) {
expand_consult();
}
--LOCAL_ConsultSp;
LOCAL_ConsultSp->r = repeat;
return true; return true;
} else if (fp->r == repeat && ap->cs.p_code.NOfClauses > 4) {
return false;
}
} }
return false; return false;
} }

View File

@ -156,7 +156,10 @@ debugger uses to write terms. If unbound, show the current options.
If `true` (default `true`) YAP checks for definitions of the same predicate that If `true` (default `true`) YAP checks for definitions of the same predicate that
are separated by clauses for other predicates. This may indicate that different are separated by clauses for other predicates. This may indicate that different
procedures have the sam*e name. procedures have the same name.
The declaration discontiguous/1 disables this warning for user-specified predicates.
*/ */
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true, booleanFlag, YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true, booleanFlag,
"false", NULL), /**< `dollar_as_lower_case ` "false", NULL), /**< `dollar_as_lower_case `

View File

@ -28,6 +28,7 @@ typedef union CONSULT_OBJ {
int mode; int mode;
Prop p; Prop p;
UInt c; UInt c;
Term r;
} consult_obj; } consult_obj;
/* Either we are assembling clauses or indexing code */ /* Either we are assembling clauses or indexing code */