- Better handling of function from M0 collapse in dot output.

This commit is contained in:
ccremers 2006-07-02 12:51:19 +00:00
parent aeac3d6616
commit 0184b6277b

View File

@ -587,47 +587,48 @@ isApplication (const System sys, const int run)
return false; return false;
} }
//! Check whether the event is an M_0 function application (special case of the previous) //! Is an event enabled by M0 only?
int int
isApplicationM0 (const System sys, const int run) isEnabledM0 (const System sys, const int run, const int ev)
{ {
if (isApplication (sys, run)) List bl;
for (bl = sys->bindings; bl != NULL; bl = bl->next)
{ {
int from_m0; Binding b;
List bl;
from_m0 = false; b = (Binding) bl->data;
if (!b->blocked)
for (bl = sys->bindings; bl != NULL; bl = bl->next)
{ {
Binding b; // if the binding is not done (class choice) we might
// still show it somewhere.
b = (Binding) bl->data; if (b->done)
if (!b->blocked)
{ {
// if the binding is not done (class choice) we might if (b->run_to == run && b->ev_to == ev)
// still show it somewhere.
if (b->done)
{ {
// The '1' denotes that the key is in the second position if (sys->runs[b->run_from].role != I_M)
if (b->run_to == run && b->ev_to == 1)
{ {
if (sys->runs[b->run_from].role == I_M) return false;
{
from_m0 = true;
}
else
{
return false;
}
} }
} }
} }
} }
if (from_m0) }
return true;
}
//! Check whether the event is an M_0 function application (special case of the previous)
int
isApplicationM0 (const System sys, const int run)
{
if (sys->runs[run].length > 1)
{
if (isApplication (sys, run))
{ {
// Source from M_0, and no others if (isEnabledM0 (sys, run, 1))
return true; {
return true;
}
} }
} }
return false; return false;
@ -963,10 +964,27 @@ regularModifiedLabel (Binding b)
void void
drawBinding (const System sys, Binding b) drawBinding (const System sys, Binding b)
{ {
int intr_to, intr_from; int intr_to, intr_from, m0_from;
void myarrow (const Binding b)
{
if (m0_from)
{
eprintf ("\t");
intruderNodeM0 ();
eprintf (" -> ");
node (sys, b->run_to, b->ev_to);
}
else
{
arrow (sys, b);
}
}
intr_from = (sys->runs[b->run_from].protocol == INTRUDER); intr_from = (sys->runs[b->run_from].protocol == INTRUDER);
intr_to = (sys->runs[b->run_to].protocol == INTRUDER); intr_to = (sys->runs[b->run_to].protocol == INTRUDER);
m0_from = false;
// Pruning: things going to M0 applications are pruned; // Pruning: things going to M0 applications are pruned;
if (isApplicationM0 (sys, b->run_to)) if (isApplicationM0 (sys, b->run_to))
@ -975,18 +993,7 @@ drawBinding (const System sys, Binding b)
} }
if (isApplicationM0 (sys, b->run_from)) if (isApplicationM0 (sys, b->run_from))
{ {
int run; m0_from = true;
int ev;
eprintf ("\t");
intruderNodeM0 ();
eprintf (" -> ");
node (sys, b->run_to, b->ev_to);
eprintf (" [label=\"");
termPrintRemap (b->term);
eprintf ("\"]");
eprintf (";\n");
return;
} }
// Normal drawing cases; // Normal drawing cases;
@ -1018,7 +1025,7 @@ drawBinding (const System sys, Binding b)
{ {
// intr->intr // intr->intr
eprintf ("\t"); eprintf ("\t");
arrow (sys, b); myarrow (b);
eprintf (" [label=\""); eprintf (" [label=\"");
termPrintRemap (b->term); termPrintRemap (b->term);
eprintf ("\"]"); eprintf ("\"]");
@ -1028,7 +1035,7 @@ drawBinding (const System sys, Binding b)
{ {
// intr->regular // intr->regular
eprintf ("\t"); eprintf ("\t");
arrow (sys, b); myarrow (b);
eprintf (";\n"); eprintf (";\n");
} }
} }
@ -1039,7 +1046,7 @@ drawBinding (const System sys, Binding b)
{ {
// regular->intr // regular->intr
eprintf ("\t"); eprintf ("\t");
arrow (sys, b); myarrow (b);
eprintf (";\n"); eprintf (";\n");
} }
else else
@ -1051,7 +1058,7 @@ drawBinding (const System sys, Binding b)
if (isCommunicationExact (sys, b)) if (isCommunicationExact (sys, b))
{ {
eprintf ("\t"); eprintf ("\t");
arrow (sys, b); myarrow (b);
eprintf (" [style=bold,color=\"%s\"]", GOODCOMMCOLOR); eprintf (" [style=bold,color=\"%s\"]", GOODCOMMCOLOR);
eprintf (";\n"); eprintf (";\n");
} }