summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-23 10:41:10 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-23 10:41:10 (GMT)
commita4007eb816c2e065915cf9cd2571c0c889aad9ba (patch)
tree820a7a9240ec9907608d70238fab00ee1e496b72 /Tools
parent28aa229fa314b3257d5a846aa2c0f1f6f56261c6 (diff)
downloadcpython-a4007eb816c2e065915cf9cd2571c0c889aad9ba.zip
cpython-a4007eb816c2e065915cf9cd2571c0c889aad9ba.tar.gz
cpython-a4007eb816c2e065915cf9cd2571c0c889aad9ba.tar.bz2
added listing of argument types encountered
Diffstat (limited to 'Tools')
-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")