From 35b9c84fc99d4e3b7d204ec5162bd68c5590bb4d Mon Sep 17 00:00:00 2001 From: ccremers Date: Mon, 5 Dec 2005 11:26:05 +0000 Subject: [PATCH] - Loop detection added, ignoring them for now. --- scripts/if2spdl/Spdl.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/if2spdl/Spdl.py b/scripts/if2spdl/Spdl.py index 6137760..b436629 100644 --- a/scripts/if2spdl/Spdl.py +++ b/scripts/if2spdl/Spdl.py @@ -139,12 +139,20 @@ def extractRoles(protocol): scan = True while scan and role.getFirstStep() != -1: scan = False - for rule in rulestodo: + for rule in protocol: if actor in rule.getActors() and rule.getStepTo() == role.getFirstStep(): - # This one works - role.prependRule(rule) - rulestodo.remove(rule) + # Remove if not yet covered scan = True + if rule in rulestodo: + rulestodo.remove(rule) + # Loop detection + if rule in role.rules: + # This is a loop TODO + print "Warning: loop detected for role", role.name + scan = False # Current setting: stop scan + else: + # No loop, prepend + role.prependRule(rule) return roles