2 from __future__
import print_function
5 stdcl = re.compile(
"^std::(.*)[^>]$")
6 stdptr = re.compile(
"(.*)_ptr$")
7 datacl = re.compile(
"^class ")
8 bfunc = re.compile(
"^function ")
9 mbcl = re.compile(
"(base|data) class")
10 farg = re.compile(
r"(.*)\(\w+\)")
11 nsep = re.compile(
r"\:\:")
13 r"::(produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream)\(")
14 baseclass = re.compile(
15 "edm::(one::|stream::|global::)?ED(Producer|Filter|Analyzer)(Base)?")
17 r"edm::eventsetup::EventSetupRecord::get<.*>\((.*)&\) const")
18 handle = re.compile(
"(.*),?class edm::ES(.*)Handle<(.*)>")
22 dataclassfuncs = set()
29 flaggedclasses = set()
31 derivedclasses = set()
38 f = open(
'classes.txt.dumperall')
41 fields = line.split(
"'")
42 if fields[2] ==
' member data class ':
43 if not stdcl.search(fields[2]):
44 Hdg.add_edge(fields[1], fields[3], kind=fields[2])
45 if fields[2] ==
' templated member data class ':
46 Hdg.add_edge(fields[1], fields[5], kind=fields[3])
47 if fields[2] ==
' base class ':
48 Hdg.add_edge(fields[1], fields[3], kind=fields[2])
49 Idg.add_edge(fields[3], fields[1], kind=
' derived class')
52 f = open(
'function-calls-db.txt')
55 if not bfunc.search(line):
57 fields = line.split(
"'")
58 if fields[2] ==
' calls function ':
59 Gdg.add_edge(fields[1], fields[3], kind=
' calls function ')
60 if getfunc.search(fields[3]):
61 dataclassfuncs.add(fields[3])
62 m = getfunc.match(fields[3])
63 n = handle.match(m.group(1))
68 p = re.sub(
"class ",
"", o)
69 dataclass = re.sub(
"struct ",
"", p)
70 dataclasses.add(dataclass)
71 if fields[2] ==
' overrides function ':
72 if baseclass.search(fields[3]):
73 Gdg.add_edge(fields[1], fields[3], kind=
' overrides function ')
74 if topfunc.search(fields[3]):
75 toplevelfuncs.add(fields[1])
77 Gdg.add_edge(fields[3], fields[1], kind=
' calls override function ')
78 if fields[2] ==
' static variable ':
79 Gdg.add_edge(fields[1], fields[3], kind=
' static variable ')
80 statics.add(fields[3])
84 nodes = sorted(dataclasses)
91 stack = [(node, iter(Hdg[node]))]
93 Qdg = nx.dfs_preorder_nodes(Idg, node)
95 print(
"class '"+q+
"'")
97 stack.append((q, iter(Hdg[q])))
99 parent, children = stack[-1]
100 print(
"class '"+parent+
"'")
103 if child
not in visited:
105 if not stdcl.search(child):
106 print(
"class '"+child+
"'")
107 stack.append((child, iter(Hdg[child])))
108 kind = Hdg[parent][child][
'kind']
109 print(parent, kind, child)
110 if stdptr.search(kind):
112 Qdg = nx.dfs_preorder_nodes(Idg, child)
114 print(
"class '"+q+
"'")
116 stack.append((q, iter(Hdg[q])))
117 except StopIteration:
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)