- Added 'termlistFind' function, which is more generic than inTermlist
This commit is contained in:
parent
d8e0e93bcf
commit
dfeaf83327
@ -133,6 +133,27 @@ inTermlist (Termlist tl, const Term term)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Determine whether a term is an element of a termlist: yield pointer
|
||||||
|
__inline__ Termlist termlistFind (Termlist tl, const Term term)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (term == NULL)
|
||||||
|
{
|
||||||
|
error ("Trying to do inTermlist for a NULL term.");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
while (tl != NULL)
|
||||||
|
{
|
||||||
|
if (isTermEqual (tl->term, term))
|
||||||
|
{
|
||||||
|
return tl;
|
||||||
|
}
|
||||||
|
tl = tl->next;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Equality of two term lists.
|
//! Equality of two term lists.
|
||||||
/**
|
/**
|
||||||
* Are all elements of list 1 in list 2, and vice versa?
|
* Are all elements of list 1 in list 2, and vice versa?
|
||||||
|
@ -29,6 +29,7 @@ void termlistDelete (Termlist tl);
|
|||||||
void termlistDestroy (Termlist tl);
|
void termlistDestroy (Termlist tl);
|
||||||
void termlistPrint (Termlist tl);
|
void termlistPrint (Termlist tl);
|
||||||
__inline__ int inTermlist (Termlist tl, const Term term);
|
__inline__ int inTermlist (Termlist tl, const Term term);
|
||||||
|
__inline__ Termlist termlistFind (Termlist tl, const Term term);
|
||||||
int isTermlistEqual (Termlist tl1, Termlist tl2);
|
int isTermlistEqual (Termlist tl1, Termlist tl2);
|
||||||
Termlist termlistAdd (Termlist tl, Term term);
|
Termlist termlistAdd (Termlist tl, Term term);
|
||||||
Termlist termlistAppend (const Termlist tl, const Term term);
|
Termlist termlistAppend (const Termlist tl, const Term term);
|
||||||
|
Loading…
Reference in New Issue
Block a user