- Added termlist iterator.

- Fixed role instance resetting role var substitutions.
This commit is contained in:
ccremers 2004-08-12 09:28:50 +00:00
parent 0f470cf6a2
commit fe960cfb6a
3 changed files with 20 additions and 0 deletions

View File

@ -656,6 +656,9 @@ roleInstance (const System sys, const Protocol protocol, const Role role,
runs[rid].locals = tolist;
runs[rid].artefacts = artefacts;
/* erase any substitutions in the role definition, as they are now copied */
termlistSubstReset (role->variables);
/* Determine symmetric run */
runs[rid].prevSymmRun = staticRunSymmetry (sys, rid); // symmetry reduction static analysis

View File

@ -774,3 +774,19 @@ termlistOrder (Termlist tl1, Termlist tl2)
else
return 1;
}
//! Iterate over terms in termlist
/**
* Function gets terms
*/
int
termlist_iterate (Termlist tl, int (*func) ())
{
while (tl != NULL)
{
if (!func (tl->term))
return 0;
tl = tl->next;
}
return 1;
}

View File

@ -54,5 +54,6 @@ int validSubst (const int matchmode, const Term term);
Term termFunction (Termlist fromlist, Termlist tolist, Term tx);
Termlist termlistForward (Termlist tl);
int termlistOrder (Termlist tl1, Termlist tl2);
int termlist_iterate (Termlist tl, int (*func) ());
#endif