diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/utils/analyzer/ubiviz | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/utils/analyzer/ubiviz')
-rwxr-xr-x | clang/utils/analyzer/ubiviz | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/clang/utils/analyzer/ubiviz b/clang/utils/analyzer/ubiviz new file mode 100755 index 0000000..1582797 --- /dev/null +++ b/clang/utils/analyzer/ubiviz @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# This script reads visualization data emitted by the static analyzer for +# display in Ubigraph. +# +##===----------------------------------------------------------------------===## + +import xmlrpclib +import sys + +def Error(message): + print >> sys.stderr, 'ubiviz: ' + message + sys.exit(1) + +def StreamData(filename): + file = open(filename) + for ln in file: + yield eval(ln) + file.close() + +def Display(G, data): + action = data[0] + if action == 'vertex': + vertex = data[1] + G.new_vertex_w_id(vertex) + for attribute in data[2:]: + G.set_vertex_attribute(vertex, attribute[0], attribute[1]) + elif action == 'edge': + src = data[1] + dst = data[2] + edge = G.new_edge(src,dst) + for attribute in data[3:]: + G.set_edge_attribute(edge, attribute[0], attribute[1]) + elif action == "vertex_style": + style_id = data[1] + parent_id = data[2] + G.new_vertex_style_w_id(style_id, parent_id) + for attribute in data[3:]: + G.set_vertex_style_attribute(style_id, attribute[0], attribute[1]) + elif action == "vertex_style_attribute": + style_id = data[1] + for attribute in data[2:]: + G.set_vertex_style_attribute(style_id, attribute[0], attribute[1]) + elif action == "change_vertex_style": + vertex_id = data[1] + style_id = data[2] + G.change_vertex_style(vertex_id,style_id) + +def main(args): + if len(args) == 0: + Error('no input files') + + server = xmlrpclib.Server('http://127.0.0.1:20738/RPC2') + G = server.ubigraph + + for arg in args: + G.clear() + for x in StreamData(arg): + Display(G,x) + + sys.exit(0) + + +if __name__ == '__main__': + main(sys.argv[1:]) + +
\ No newline at end of file |