Skip to content

Commit

Permalink
added returns
Browse files Browse the repository at this point in the history
  • Loading branch information
tjulien committed Feb 20, 2010
1 parent dba869e commit a1a9527
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,23 @@ def get_calls(self, rows):

def create_seq_diag_input(self, calls):
input = ''
for call in calls:
input += call['caller'] + " -> " + call['callee'] + ": " + call['input'] + '\n'
return_stack = []
for i, call in enumerate(calls):
input += call['caller'] + " -> " + call['callee'] + ": {" + call['input'] + '}\n'
return_call = call['callee'] + " -> " + call['caller'] + ": {" + call['result'] + '}\n'
if(i < len(calls) - 1):
if calls[i + 1]['caller'] == call['callee']:
# save return for later
return_stack.append(return_call)
else:
# return call immediately
input += return_call
else:
# end of the calls, now pop return_stack
input += return_call
return_stack.reverse()
for return_call in return_stack:
input += return_call
return input

def get_seq_diag(self, text, outputFile, style = 'modern-blue' ):
Expand Down

0 comments on commit a1a9527

Please sign in to comment.