From 3673fc689d4e01709e27ec6c178721ec427a00f9 Mon Sep 17 00:00:00 2001 From: ccremers Date: Thu, 28 Oct 2004 12:56:13 +0000 Subject: [PATCH] - Improved roledef printing by adding roledefPrintShort. --- src/arachne.c | 4 ++-- src/role.c | 32 +++++++++++++++++++++++++++----- src/role.h | 1 + 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/arachne.c b/src/arachne.c index 3226503..c28c0af 100644 --- a/src/arachne.c +++ b/src/arachne.c @@ -778,7 +778,7 @@ dotSemiState () eprintf ("shape=box,"); } eprintf ("label=\""); - roledefPrint (rd); + roledefPrintShort (rd); eprintf ("\"]"); eprintf (";\n"); @@ -827,7 +827,7 @@ 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 ", run,run); + eprintf ("\t\ts%i [label=\"Run %i\\n", run,run); agentsOfRunPrint (sys, run); eprintf ("\", shape=diamond];\n"); eprintf ("\t\ts%i -> ", run); diff --git a/src/role.c b/src/role.c index 1d01a3f..c946086 100644 --- a/src/role.c +++ b/src/role.c @@ -27,8 +27,11 @@ makeRoledef () } //! Print a role event. +/** + * If print_actor is true, the actor is included (OS version), otherwise it is left out (short stuff) + */ void -roledefPrint (Roledef rd) +roledefPrintGeneric (Roledef rd, int print_actor) { if (rd == NULL) { @@ -79,12 +82,18 @@ roledefPrint (Roledef rd) eprintf ("("); if (!(rd->from == NULL && rd->to == NULL)) { - termPrint (rd->from); - eprintf (","); + if (print_actor || rd->type == READ) + { + termPrint (rd->from); + eprintf (","); + } if (rd->type == CLAIM) eprintf (" "); - termPrint (rd->to); - eprintf (", "); + if (print_actor || rd->type != READ) + { + termPrint (rd->to); + eprintf (", "); + } } termPrint (rd->message); eprintf (" )"); @@ -92,6 +101,19 @@ roledefPrint (Roledef rd) eprintf ("$"); } +void +roledefPrint (Roledef rd) +{ + roledefPrintGeneric (rd, 1); +} + +void +roledefPrintShort (Roledef rd) +{ + roledefPrintGeneric (rd, 0); +} + + //! Duplicate a single role event node. /** *\sa roledefDelete() diff --git a/src/role.h b/src/role.h index e418b23..5e3f062 100644 --- a/src/role.h +++ b/src/role.h @@ -126,6 +126,7 @@ struct role typedef struct role *Role; void roledefPrint (Roledef rd); +void roledefPrintShort (Roledef rd); Roledef roledefDuplicate1 (const Roledef rd); Roledef roledefDuplicate (Roledef rd); void roledefDelete (Roledef rd);