Commit 26a93905 authored by Maxime Perrotin's avatar Maxime Perrotin

Target creation of a neato graph

parent c3ce914a
group taste;
interface_view(arrsFunctNames) ::= <<
-- TASTE Interface View
<arrsFunctNames: {each|Function <each>}; separator="\n">
>>
interface_view(arrsFunctNames, arrsConnections) ::= <<
# TASTE Interface View
# Save this output to file.dot and run "neato file.dot -Tpng -o out.png"
graph interfaceview {
<arrsFunctNames: {each| <each> [shape=box, label="<each>"];}; separator="\n">
<arrsConnections; separator="\n">
}
>>
connection(sFrom, sTo, arrsMessages) ::= <<
<sFrom> -> <sTo> [label="[<arrsMessages; separator=",\n">]"];
>>
#!/usr/bin/env python2
import iv
from collections import defaultdict
import stringtemplate3
import iv
STG = None
......@@ -20,7 +21,23 @@ tpl = new("interface_view")
tpl['arrsFunctNames'] = iv.functions.keys()
connections = [] # type: List[str]
for fromName, content in iv.functions.viewitems():
group = defaultdict(list)
for iName, iContent in content['interfaces'].viewitems():
if iContent['direction'] == iv.RI:
group[iContent['distant_fv']].append(iName)
for destName, destContent in group.viewitems():
tplConn = new("connection")
tplConn['sFrom'] = fromName
tplConn['sTo'] = destName
tplConn['arrsMessages'] = destContent
connections.append(str(tplConn))
tpl['arrsConnections'] = connections
print str(tpl).encode('latin1')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment