Convert print statements to function calls in Tools/.

This commit is contained in:
Collin Winter 2007-08-03 17:06:41 +00:00
parent e5d0e8431f
commit 6afaeb757a
66 changed files with 777 additions and 779 deletions

View file

@ -80,7 +80,7 @@ def readinput(fp):
store(file2undef, fn, name)
store(undef2file, name, fn)
elif not type in ignore:
print fn + ':' + name + ': unknown type ' + type
print(fn + ':' + name + ': unknown type ' + type)
# Print all names that were undefined in some module and where they are
# defined.
@ -89,7 +89,7 @@ def printcallee():
flist = file2undef.keys()
flist.sort()
for filename in flist:
print filename + ':'
print(filename + ':')
elist = file2undef[filename]
elist.sort()
for ext in elist:
@ -98,9 +98,9 @@ def printcallee():
else:
tabs = '\t\t'
if not def2file.has_key(ext):
print '\t' + ext + tabs + ' *undefined'
print('\t' + ext + tabs + ' *undefined')
else:
print '\t' + ext + tabs + flat(def2file[ext])
print('\t' + ext + tabs + flat(def2file[ext]))
# Print for each module the names of the other modules that use it.
#
@ -114,14 +114,14 @@ def printcaller():
callers = callers + undef2file[label]
if callers:
callers.sort()
print filename + ':'
print(filename + ':')
lastfn = ''
for fn in callers:
if fn <> lastfn:
print '\t' + fn
print('\t' + fn)
lastfn = fn
else:
print filename + ': unused'
print(filename + ': unused')
# Print undefined names and where they are used.
#
@ -134,11 +134,11 @@ def printundef():
elist = undefs.keys()
elist.sort()
for ext in elist:
print ext + ':'
print(ext + ':')
flist = undefs[ext]
flist.sort()
for filename in flist:
print '\t' + filename
print('\t' + filename)
# Print warning messages about names defined in more than one file.
#
@ -149,8 +149,8 @@ def warndups():
names.sort()
for name in names:
if len(def2file[name]) > 1:
print 'warning:', name, 'multiply defined:',
print flat(def2file[name])
print('warning:', name, 'multiply defined:', end=' ')
print(flat(def2file[name]))
sys.stdout = savestdout
# Main program
@ -160,14 +160,14 @@ def main():
optlist, args = getopt.getopt(sys.argv[1:], 'cdu')
except getopt.error:
sys.stdout = sys.stderr
print 'Usage:', os.path.basename(sys.argv[0]),
print '[-cdu] [file] ...'
print '-c: print callers per objectfile'
print '-d: print callees per objectfile'
print '-u: print usage of undefined symbols'
print 'If none of -cdu is specified, all are assumed.'
print 'Use "nm -o" to generate the input (on IRIX: "nm -Bo"),'
print 'e.g.: nm -o /lib/libc.a | objgraph'
print('Usage:', os.path.basename(sys.argv[0]), end=' ')
print('[-cdu] [file] ...')
print('-c: print callers per objectfile')
print('-d: print callees per objectfile')
print('-u: print usage of undefined symbols')
print('If none of -cdu is specified, all are assumed.')
print('Use "nm -o" to generate the input (on IRIX: "nm -Bo"),')
print('e.g.: nm -o /lib/libc.a | objgraph')
return 1
optu = optc = optd = 0
for opt, void in optlist:
@ -192,15 +192,15 @@ def main():
more = (optu + optc + optd > 1)
if optd:
if more:
print '---------------All callees------------------'
print('---------------All callees------------------')
printcallee()
if optu:
if more:
print '---------------Undefined callees------------'
print('---------------Undefined callees------------')
printundef()
if optc:
if more:
print '---------------All Callers------------------'
print('---------------All Callers------------------')
printcaller()
return 0