Removed another trampoline; one of the type where omitting function argument types reduces warnings. Ouch.

This commit is contained in:
Cas Cremers 2018-11-04 23:24:56 +01:00
parent 131ee69f1d
commit cdda26f21f
4 changed files with 29 additions and 24 deletions

View File

@ -1,15 +1,10 @@
2 iterateTermOther arachne.c +1053 ; system.c +1155
1 subtermUnify arachne.c +961
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
term_iterate_leaves
term_iterate_state_leaves
dependencies:
iterateTermOther is called using makeDepend and addOther
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)

View File

@ -1669,6 +1669,11 @@ drawIntruderRuns (const System sys)
}
}
struct state_dss
{
Termlist found;
};
//! Display the current semistate using dot output format.
/**
* This is not as nice as we would like it. Furthermore, the function is too big.
@ -1777,9 +1782,10 @@ dotSemiState (const System mysys)
*/
Termlist found;
List bl;
struct state_dss Sdss;
// collect the intruder-generated constants
found = NULL;
Sdss.found = NULL;
for (bl = sys->bindings; bl != NULL; bl = bl->next)
{
Binding b;
@ -1787,21 +1793,21 @@ dotSemiState (const System mysys)
b = (Binding) bl->data;
if (!b->blocked)
{
int addsubterms (Term t)
int addsubterms (Term t, struct state_dss *sdss)
{
if (isIntruderChoice (t))
{
found = termlistAddNew (found, t);
sdss->found = termlistAddNew (sdss->found, t);
}
return true;
}
term_iterate_open_leaves (b->term, addsubterms);
term_iterate_state_open_leaves (b->term, addsubterms, &Sdss);
}
}
// now maybe we draw the node
if ((from_intruder_count > 0) || (found != NULL))
if ((from_intruder_count > 0) || (Sdss.found != NULL))
{
eprintf ("\tintruder [\n");
eprintf ("\t\tlabel=\"");
@ -1810,14 +1816,14 @@ dotSemiState (const System mysys)
{
eprintf ("\\n");
eprintf ("The intruder generates: ");
termlistPrintRemap (found, ", ");
termlistPrintRemap (Sdss.found, ", ");
}
eprintf ("\",\n");
eprintf ("\t\tstyle=filled,fillcolor=\"");
printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS);
eprintf ("\"\n\t];\n");
}
termlistDelete (found);
termlistDelete (Sdss.found);
}
// eprintf ("\t};\n");

View File

@ -1148,7 +1148,7 @@ 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_open_leaves (const Term term, int (*func) (Term t))
term_iterate_state_open_leaves (const Term term, int (*func) (), void *state)
{
if (term != NULL)
{
@ -1156,21 +1156,26 @@ term_iterate_open_leaves (const Term term, int (*func) (Term t))
{
if (substVar (term))
{
return term_iterate_open_leaves (term->subst, func);
return term_iterate_state_open_leaves (term->subst, func,
state);
}
else
{
return func (term);
return func (term, state);
}
}
else
{
if (realTermTuple (term))
return (term_iterate_open_leaves (TermOp1 (term), func)
&& term_iterate_open_leaves (TermOp2 (term), func));
return (term_iterate_state_open_leaves
(TermOp1 (term), func, state)
&& term_iterate_state_open_leaves (TermOp2 (term), func,
state));
else
return (term_iterate_open_leaves (TermOp (term), func)
&& term_iterate_open_leaves (TermKey (term), func));
return (term_iterate_state_open_leaves
(TermOp (term), func, state)
&& term_iterate_state_open_leaves (TermKey (term), func,
state));
}
}
return 1;

View File

@ -196,11 +196,10 @@ int term_iterate (const Term term, int (*leaf) (Term t),
int (*noder) (Term t));
int term_iterate_state_deVar (Term term, int (*leaf) (),
int (*nodel) (),
int (*nodem) (),
int (*noder) (), void (*state));
int term_iterate_state_leaves (const Term term,
int (*func) (), void (*state));
int term_iterate_open_leaves (const Term term, int (*func) (Term t));
int (*nodem) (), int (*noder) (), void *state);
int term_iterate_state_leaves (const Term term, int (*func) (), void *state);
int term_iterate_state_open_leaves (const Term term, int (*func) (),
void *state);
void term_rolelocals_are_variables ();
int term_encryption_level (const Term term);
float term_constrain_level (const Term term);