1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
@initialize:python@
@@
coccinelle.tbl = {}
local = set()
def inc(f):
try:
coccinelle.tbl[f] += 1
except KeyError:
coccinelle.tbl[f] = 1
@script:python@
@@
local.clear()
@r@
identifier f;
@@
f(...) { ... }
@script:python@
f << r.f;
@@
local.add(f)
@r1@
identifier f;
type T;
@@
T f(...);
@script:python@
f << r1.f;
@@
local.add(f)
@s@
identifier f;
@@
f(...);
@script:python@
f << s.f;
@@
if f not in local and f.lower() == f:
inc(f)
@finalize:python@
tbls << merge.tbl;
@@
tbl = tbls[0]
for i in range(1, len(tbls)):
tbl.update(tbls[i])
for (v, f) in sorted([(v, k) for (k, v) in tbl.items()], reverse = True):
print("{}: {}".format(f, v))
|