- Loop detection added, ignoring them for now.

This commit is contained in:
ccremers 2005-12-05 11:26:05 +00:00
parent cd8f8db0a8
commit 35b9c84fc9

View File

@ -139,12 +139,20 @@ def extractRoles(protocol):
scan = True scan = True
while scan and role.getFirstStep() != -1: while scan and role.getFirstStep() != -1:
scan = False scan = False
for rule in rulestodo: for rule in protocol:
if actor in rule.getActors() and rule.getStepTo() == role.getFirstStep(): if actor in rule.getActors() and rule.getStepTo() == role.getFirstStep():
# This one works # Remove if not yet covered
role.prependRule(rule)
rulestodo.remove(rule)
scan = True 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 return roles