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 2 iterateTermOther arachne.c +1053 ; system.c +1155
1 subtermUnify arachne.c +961 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 3 unify mgu.c +233 ; mgu.c +247 ; mgu.c +281
term_iterate_leaves
term_iterate_state_leaves
dependencies: dependencies:
iterateTermOther is called using makeDepend and addOther iterateTermOther is called using makeDepend and addOther
subtermUnify is called using unifiesWithKeys 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) 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. //! Display the current semistate using dot output format.
/** /**
* This is not as nice as we would like it. Furthermore, the function is too big. * 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; Termlist found;
List bl; List bl;
struct state_dss Sdss;
// collect the intruder-generated constants // collect the intruder-generated constants
found = NULL; Sdss.found = NULL;
for (bl = sys->bindings; bl != NULL; bl = bl->next) for (bl = sys->bindings; bl != NULL; bl = bl->next)
{ {
Binding b; Binding b;
@ -1787,21 +1793,21 @@ dotSemiState (const System mysys)
b = (Binding) bl->data; b = (Binding) bl->data;
if (!b->blocked) if (!b->blocked)
{ {
int addsubterms (Term t) int addsubterms (Term t, struct state_dss *sdss)
{ {
if (isIntruderChoice (t)) if (isIntruderChoice (t))
{ {
found = termlistAddNew (found, t); sdss->found = termlistAddNew (sdss->found, t);
} }
return true; return true;
} }
term_iterate_open_leaves (b->term, addsubterms); term_iterate_state_open_leaves (b->term, addsubterms, &Sdss);
} }
} }
// now maybe we draw the node // 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 ("\tintruder [\n");
eprintf ("\t\tlabel=\""); eprintf ("\t\tlabel=\"");
@ -1810,14 +1816,14 @@ dotSemiState (const System mysys)
{ {
eprintf ("\\n"); eprintf ("\\n");
eprintf ("The intruder generates: "); eprintf ("The intruder generates: ");
termlistPrintRemap (found, ", "); termlistPrintRemap (Sdss.found, ", ");
} }
eprintf ("\",\n"); eprintf ("\",\n");
eprintf ("\t\tstyle=filled,fillcolor=\""); eprintf ("\t\tstyle=filled,fillcolor=\"");
printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS); printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS);
eprintf ("\"\n\t];\n"); eprintf ("\"\n\t];\n");
} }
termlistDelete (found); termlistDelete (Sdss.found);
} }
// eprintf ("\t};\n"); // 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. * well. It is up to func to decide wether or not to recurse.
*/ */
int 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) if (term != NULL)
{ {
@ -1156,21 +1156,26 @@ term_iterate_open_leaves (const Term term, int (*func) (Term t))
{ {
if (substVar (term)) if (substVar (term))
{ {
return term_iterate_open_leaves (term->subst, func); return term_iterate_state_open_leaves (term->subst, func,
state);
} }
else else
{ {
return func (term); return func (term, state);
} }
} }
else else
{ {
if (realTermTuple (term)) if (realTermTuple (term))
return (term_iterate_open_leaves (TermOp1 (term), func) return (term_iterate_state_open_leaves
&& term_iterate_open_leaves (TermOp2 (term), func)); (TermOp1 (term), func, state)
&& term_iterate_state_open_leaves (TermOp2 (term), func,
state));
else else
return (term_iterate_open_leaves (TermOp (term), func) return (term_iterate_state_open_leaves
&& term_iterate_open_leaves (TermKey (term), func)); (TermOp (term), func, state)
&& term_iterate_state_open_leaves (TermKey (term), func,
state));
} }
} }
return 1; return 1;

View File

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