- Improved the .dot output format quite a bit.
This commit is contained in:
parent
aa70b19142
commit
5c90a5af29
@ -890,7 +890,11 @@ dotSemiState ()
|
|||||||
}
|
}
|
||||||
// Draw the first box
|
// Draw the first box
|
||||||
// This used to be drawn only if done && send_before_read, now we always draw it.
|
// 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);
|
agentsOfRunPrint (sys, run);
|
||||||
eprintf ("\", shape=diamond];\n");
|
eprintf ("\", shape=diamond];\n");
|
||||||
eprintf ("\t\ts%i -> ", run);
|
eprintf ("\t\ts%i -> ", run);
|
||||||
|
@ -57,12 +57,19 @@ roledefPrintGeneric (Roledef rd, int print_actor)
|
|||||||
//! Print label
|
//! Print label
|
||||||
Term label;
|
Term label;
|
||||||
|
|
||||||
|
/* Old version: sometimes prints protocol stuff (really unique labels)
|
||||||
label = deVar (rd->label);
|
label = deVar (rd->label);
|
||||||
if (protocolCount < 2 && realTermTuple (label))
|
if (protocolCount < 2 && realTermTuple (label))
|
||||||
{
|
{
|
||||||
// Only one protocol, so we don't need to show the extra label info
|
// Only one protocol, so we don't need to show the extra label info
|
||||||
label = TermOp2 (label);
|
label = TermOp2 (label);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
label = deVar(rd->label);
|
||||||
|
if (realTermTuple (label))
|
||||||
|
{
|
||||||
|
label = TermOp2 (label);
|
||||||
|
}
|
||||||
|
|
||||||
//! Print latex/normal
|
//! Print latex/normal
|
||||||
if (globalLatex)
|
if (globalLatex)
|
||||||
|
61
src/system.c
61
src/system.c
@ -366,30 +366,61 @@ not_read_first (const Roledef rdstart, const Term t)
|
|||||||
Term
|
Term
|
||||||
agentOfRunRole (const System sys, const int run, const Term role)
|
agentOfRunRole (const System sys, const int run, const Term role)
|
||||||
{
|
{
|
||||||
Termlist roles = sys->runs[run].protocol->rolenames;
|
if (sys->engine != ARACHNE_ENGINE)
|
||||||
Termlist agents = sys->runs[run].agents;
|
|
||||||
|
|
||||||
/* TODO stupid reversed order, lose that soon */
|
|
||||||
if (agents != NULL)
|
|
||||||
{
|
{
|
||||||
agents = termlistForward (agents);
|
// Non-arachne
|
||||||
while (agents != NULL && roles != NULL)
|
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)
|
||||||
{
|
{
|
||||||
if (isTermEqual (roles->term, role))
|
agents = termlistForward (agents);
|
||||||
|
while (agents != NULL && roles != NULL)
|
||||||
{
|
{
|
||||||
return agents->term;
|
if (isTermEqual (roles->term, role))
|
||||||
|
{
|
||||||
|
return agents->term;
|
||||||
|
}
|
||||||
|
agents = agents->prev;
|
||||||
|
roles = roles->next;
|
||||||
}
|
}
|
||||||
agents = agents->prev;
|
|
||||||
roles = roles->next;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error
|
||||||
|
("Agent list for run %i is empty, so agentOfRunRole is not usable.",
|
||||||
|
run);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error
|
// Arachne engine
|
||||||
("Agent list for run %i is empty, so agentOfRunRole is not usable.",
|
Termlist agents;
|
||||||
run);
|
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Yield the actor agent of a run in the system.
|
//! Yield the actor agent of a run in the system.
|
||||||
|
Loading…
Reference in New Issue
Block a user