- Extra checks:
* For incomplete protocols, better handling of dangling labels. * For termSubTerm better handling of NULL cases.
This commit is contained in:
parent
c8d2222c58
commit
cee11bc0af
@ -503,6 +503,8 @@ arachne_runs_agree (const System sys, const Claimlist cl, const Termmap runs)
|
|||||||
int run;
|
int run;
|
||||||
|
|
||||||
run = termmapGet (runs, role);
|
run = termmapGet (runs, role);
|
||||||
|
if (run != -1)
|
||||||
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (run < 0 || run >= sys->maxruns)
|
if (run < 0 || run >= sys->maxruns)
|
||||||
{
|
{
|
||||||
@ -539,6 +541,11 @@ arachne_runs_agree (const System sys, const Claimlist cl, const Termmap runs)
|
|||||||
}
|
}
|
||||||
return rd_res;
|
return rd_res;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
linfo = label_find (sys->labellist, labels->term);
|
linfo = label_find (sys->labellist, labels->term);
|
||||||
|
28
src/term.c
28
src/term.c
@ -237,6 +237,7 @@ isTermEqualFn (Term term1, Term term2)
|
|||||||
/**
|
/**
|
||||||
*@param t Term to be checked for a subterm.
|
*@param t Term to be checked for a subterm.
|
||||||
*@param tsub Subterm.
|
*@param tsub Subterm.
|
||||||
|
* Note that if t is non-null and tsub is null, it is a valid subterm.
|
||||||
*@return True iff tsub is a subterm of t.
|
*@return True iff tsub is a subterm of t.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@ -246,15 +247,39 @@ termSubTerm (Term t, Term tsub)
|
|||||||
tsub = deVar (tsub);
|
tsub = deVar (tsub);
|
||||||
|
|
||||||
if (isTermEqual (t, tsub))
|
if (isTermEqual (t, tsub))
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
if (realTermLeaf (t))
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (t == NULL)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tsub == NULL)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (realTermLeaf (t))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (realTermTuple (t))
|
if (realTermTuple (t))
|
||||||
return (termSubTerm (TermOp1 (t), tsub)
|
return (termSubTerm (TermOp1 (t), tsub)
|
||||||
|| termSubTerm (TermOp2 (t), tsub));
|
|| termSubTerm (TermOp2 (t), tsub));
|
||||||
else
|
else
|
||||||
return (termSubTerm (TermOp (t), tsub)
|
return (termSubTerm (TermOp (t), tsub)
|
||||||
|| termSubTerm (TermKey (t), tsub));
|
|| termSubTerm (TermKey (t), tsub));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! See if a term is an interm of another.
|
//! See if a term is an interm of another.
|
||||||
@ -1301,7 +1326,6 @@ termPrintDiff (Term t1, Term t2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user