Removed term_iterate_leaves.

This commit is contained in:
Cas Cremers 2018-10-31 23:48:45 +01:00
parent fe1be9b3f0
commit 92c5b0bedc
3 changed files with 13 additions and 29 deletions

View File

@ -3,7 +3,6 @@
1 term_iterate_open_leaves dotout.c +1790 // Could be replaced by term_iterate_leaves
3 unify mgu.c +233 ; mgu.c +247 ; mgu.c +281
1 iterateLocalToOther prune_theorems.c +108
1 term_iterate_leaves term.c +1145
term_iterate_leaves
term_iterate_state_leaves
@ -15,5 +14,4 @@ subtermUnify is called using unifiesWithKeys
term_iterate_open_leaves is called using addsubterms
unify is called using unify_combine_enc and unify_combined_tup, and a callback using the keys list? (which propagates back to subtermunify data)
iterateLocalToOther is called using checkTerm
term_iterate_leaves is called using testleaf

View File

@ -1148,47 +1148,34 @@ term_iterate_state_leaves (const Term term, int (*func) (), void (*state))
* well. It is up to func to decide wether or not to recurse.
*/
int
term_iterate_leaves (const Term term, int (*func) (Term t))
term_iterate_open_leaves (const Term term, int (*func) (Term t))
{
if (term != NULL)
{
if (realTermLeaf (term))
{
if (!func (term))
return 0;
if (substVar (term))
{
return term_iterate_open_leaves (term->subst, func);
}
else
{
return func (term);
}
}
else
{
if (realTermTuple (term))
return (term_iterate_leaves (TermOp1 (term), func)
&& term_iterate_leaves (TermOp2 (term), func));
return (term_iterate_open_leaves (TermOp1 (term), func)
&& term_iterate_open_leaves (TermOp2 (term), func));
else
return (term_iterate_leaves (TermOp (term), func)
&& term_iterate_leaves (TermKey (term), func));
return (term_iterate_open_leaves (TermOp (term), func)
&& term_iterate_open_leaves (TermKey (term), func));
}
}
return 1;
}
//! Iterate over open leaves (i.e. respect variable closure)
int
term_iterate_open_leaves (const Term term, int (*func) (Term t))
{
int testleaf (const Term t)
{
if (substVar (t))
{
return term_iterate_open_leaves (t->subst, func);
}
else
{
return func (t);
}
}
return term_iterate_leaves (term, testleaf);
}
//! Turn all rolelocals into variables
void
term_rolelocals_are_variables ()

View File

@ -198,7 +198,6 @@ int term_iterate_state_deVar (Term term, int (*leaf) (),
int (*nodel) (),
int (*nodem) (),
int (*noder) (), void (*state));
int term_iterate_leaves (const Term t, int (*func) (Term t));
int term_iterate_state_leaves (const Term term,
int (*func) (), void (*state));
int term_iterate_open_leaves (const Term term, int (*func) (Term t));