summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tools/bgen/bgen/scantools.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Tools/bgen/bgen/scantools.py b/Tools/bgen/bgen/scantools.py
index 4a6fd7c..ff76d6c 100644
--- a/Tools/bgen/bgen/scantools.py
+++ b/Tools/bgen/bgen/scantools.py
@@ -44,10 +44,27 @@ class Scanner:
self.initpatterns()
self.compilepatterns()
self.initosspecifics()
+ self.initusedtypes()
if output:
self.setoutput(output, defsoutput)
if input:
self.setinput(input)
+
+ def initusedtypes(self):
+ self.usedtypes = {}
+
+ def typeused(self, type, mode):
+ if not self.usedtypes.has_key(type):
+ self.usedtypes[type] = {}
+ self.usedtypes[type][mode] = None
+
+ def reportusedtypes(self):
+ types = self.usedtypes.keys()
+ types.sort()
+ for type in types:
+ modes = self.usedtypes[type].keys()
+ modes.sort()
+ print type, string.join(modes)
def initsilent(self):
self.silent = 0
@@ -330,6 +347,7 @@ class Scanner:
continue
except EOFError:
self.error("Uncaught EOF error")
+ self.reportusedtypes()
def dosymdef(self):
name, defn = self.sym.group('name', 'defn')
@@ -448,10 +466,12 @@ class Scanner:
return new
def generate(self, type, name, arglist):
+ self.typeused(type, 'return')
classname, listname = self.destination(type, name, arglist)
if not self.specfile: return
self.specfile.write("f = %s(%s, %s,\n" % (classname, type, `name`))
for atype, aname, amode in arglist:
+ self.typeused(atype, amode)
self.specfile.write(" (%s, %s, %s),\n" %
(atype, `aname`, amode))
self.specfile.write(")\n")