From: Tim Vieira Date: Mon, 3 Dec 2012 21:13:36 +0000 (-0500) Subject: dump update plans to html output; clean up X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=d47babb81a00b39bbfc9d3ec10e480c106e93a48;p=dyna2 dump update plans to html output; clean up --- diff --git a/bin/prototype.py b/bin/prototype.py old mode 100755 new mode 100644 index c30cb07..66aba57 --- a/bin/prototype.py +++ b/bin/prototype.py @@ -252,17 +252,16 @@ def circuit(anf): g.head = head g.result = result + g.side = side + g.inputs = [x for x in g.nodes if not g.incoming[x]] g.outputs = [x for x in g.nodes if not g.outgoing[x]] g.intermediate = [x for x in g.nodes if g.incoming[x] and g.outgoing[x]] - g.side = side return g -def graph_styles(g, anf): - - (_, head, side, _, _, result) = anf +def graph_styles(g): sty = defaultdict(dict) # style overrides and additions @@ -280,12 +279,12 @@ def graph_styles(g, anf): if isvar(x): # input variables are bold sty[x].update({'penwidth': '3'}) - if x in side: + if x in g.side: sty[x].update({'style': 'filled', 'fillcolor': 'olivedrab2'}) # distinguish circuit head and result - sty[head].update({'style': 'filled', 'fillcolor': 'lightblue'}) - sty[result].update({'style': 'filled', 'fillcolor': 'salmon'}) + sty[g.head].update({'style': 'filled', 'fillcolor': 'lightblue'}) + sty[g.result].update({'style': 'filled', 'fillcolor': 'salmon'}) return sty @@ -317,17 +316,10 @@ def main(dynafile): print >> html, '

Hyperedge templates

' - rules = [] - - for i, x in enumerate(read_anf(anf)): - g = circuit(x) - - rules.append(g) - - sty = graph_styles(g, x) - + rules = [circuit(x) for x in read_anf(anf)] + for i, g in enumerate(rules): + sty = graph_styles(g) svg = g.render(dynafile + '.d/rule-%s' % i, sty) - print >> html, '
%s
' % svg @@ -360,6 +352,18 @@ def main(dynafile): d = display_mode(M, o) print '%-40s %s' % (e, d) + print >> html, '

Update %s

' % (e,) + + print >> html, '' + for e, mode in reversed(plan): + if mode is None: + continue + (M, o) = mode + d = display_mode_nocolor(M, o) + print >> html, '' % (e, d) + print >> html, '
%s%s
' + + # TODO: plate notation for loop structure. #svg = uplan_graph.render('/tmp/tmp')