- Improved the .dot output format quite a bit.

This commit is contained in:
ccremers 2005-02-21 15:12:59 +00:00
parent aa70b19142
commit 5c90a5af29
3 changed files with 58 additions and 16 deletions

View File

@ -890,7 +890,11 @@ dotSemiState ()
}
// Draw the first box
// This used to be drawn only if done && send_before_read, now we always draw it.
eprintf ("\t\ts%i [label=\"Run %i\\n", run, run);
eprintf ("\t\ts%i [label=\"Run %i: ", run, run);
termPrint (sys->runs[run].protocol->nameterm);
eprintf (", ");
termPrint (sys->runs[run].role->nameterm);
eprintf ("\\n");
agentsOfRunPrint (sys, run);
eprintf ("\", shape=diamond];\n");
eprintf ("\t\ts%i -> ", run);

View File

@ -57,12 +57,19 @@ roledefPrintGeneric (Roledef rd, int print_actor)
//! Print label
Term label;
/* Old version: sometimes prints protocol stuff (really unique labels)
label = deVar (rd->label);
if (protocolCount < 2 && realTermTuple (label))
{
// Only one protocol, so we don't need to show the extra label info
label = TermOp2 (label);
}
*/
label = deVar(rd->label);
if (realTermTuple (label))
{
label = TermOp2 (label);
}
//! Print latex/normal
if (globalLatex)

View File

@ -366,8 +366,14 @@ not_read_first (const Roledef rdstart, const Term t)
Term
agentOfRunRole (const System sys, const int run, const Term role)
{
Termlist roles = sys->runs[run].protocol->rolenames;
Termlist agents = sys->runs[run].agents;
if (sys->engine != ARACHNE_ENGINE)
{
// Non-arachne
Termlist roles;
Termlist agents;
roles = sys->runs[run].protocol->rolenames;
agents = sys->runs[run].agents;
/* TODO stupid reversed order, lose that soon */
if (agents != NULL)
@ -390,6 +396,31 @@ agentOfRunRole (const System sys, const int run, const Term role)
run);
}
return NULL;
}
else
{
// Arachne engine
Termlist agents;
// Agent variables have the same symbol as the role names, so
// we can scan for this.
agents = sys->runs[run].agents;
while (agents != NULL)
{
Term agent;
agent = agents->term;
if (TermSymb(role) == TermSymb(agent))
{
return agent;
}
else
{
agents = agents->next;
}
}
return NULL;
}
}
//! Yield the actor agent of a run in the system.