- Added iterators.
- More space in encryption notation for better readability.
This commit is contained in:
parent
2280187b32
commit
895852de89
@ -361,6 +361,55 @@ valid_binding (Binding b)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Iterate over valid bindings
|
||||||
|
/**
|
||||||
|
* Iterator should return true to proceed
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
iterate_bindings (int (*func) (Binding b))
|
||||||
|
{
|
||||||
|
List bl;
|
||||||
|
|
||||||
|
for (bl = sys->bindings; bl != NULL; bl = bl->next)
|
||||||
|
{
|
||||||
|
Binding b;
|
||||||
|
|
||||||
|
b = (Binding) bl->data;
|
||||||
|
if (valid_binding (b))
|
||||||
|
{
|
||||||
|
if (!func (b))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//! Iterate over preceding bindings (this does not include stuff bound to the same destination)
|
||||||
|
/**
|
||||||
|
* Iterator should return true to proceed
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
iterate_preceding_bindings (const int run, const int ev,
|
||||||
|
int (*func) (Binding b))
|
||||||
|
{
|
||||||
|
int precs (Binding b)
|
||||||
|
{
|
||||||
|
if (isDependEvent (b->run_to, b->ev_to, run, ev))
|
||||||
|
{
|
||||||
|
return func (b);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return iterate_bindings (precs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Check for unique origination
|
//! Check for unique origination
|
||||||
/*
|
/*
|
||||||
* Contrary to a previous version, we simply check for unique origination.
|
* Contrary to a previous version, we simply check for unique origination.
|
||||||
@ -435,6 +484,7 @@ unique_origination ()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Prune invalid state w.r.t. <=C minimal requirement
|
//! Prune invalid state w.r.t. <=C minimal requirement
|
||||||
/**
|
/**
|
||||||
* Intuition says this can be done a lot more efficient. Luckily this is the prototype.
|
* Intuition says this can be done a lot more efficient. Luckily this is the prototype.
|
||||||
|
@ -43,6 +43,10 @@ int binding_block (Binding b);
|
|||||||
int binding_unblock (Binding b);
|
int binding_unblock (Binding b);
|
||||||
int labels_ordered (Termmap runs, Termlist labels);
|
int labels_ordered (Termmap runs, Termlist labels);
|
||||||
|
|
||||||
|
int iterate_bindings (int (*func) (Binding b));
|
||||||
|
int iterate_preceding_bindings (const int run, const int ev,
|
||||||
|
int (*func) (Binding b));
|
||||||
|
|
||||||
int bindings_c_minimal ();
|
int bindings_c_minimal ();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -364,9 +364,9 @@ termPrint (Term term)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* normal encryption */
|
/* normal encryption */
|
||||||
eprintf ("{");
|
eprintf ("{ ");
|
||||||
termTuplePrint (TermOp (term));
|
termTuplePrint (TermOp (term));
|
||||||
eprintf ("}");
|
eprintf (" }");
|
||||||
termPrint (TermKey (term));
|
termPrint (TermKey (term));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user