Cleaned up and formatted output of symbol table descriptor.
1 parent d842856 commit 1e449107d18a0d6f9b989f532a6a8989427e0c59
@tundra tundra authored on 19 Mar 2004
Showing 1 changed file
View
29
test-tc.py
#!/usr/bin/env python
# Copyright (c) 2003-2004 TundraWare Inc. All Rights Reserved.
 
PROGNAME = "tconfpy Test Driver"
RCSID = "$Id: test-tc.py,v 1.111 2004/03/20 00:03:54 tundra Exp $"
RCSID = "$Id: test-tc.py,v 1.112 2004/03/20 00:40:01 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
BANNER = "%s\n%s\n%s\n" % (PROGINFO, COPYRIGHT, RCSID)
 
import tconfpy
import sys
 
 
##########
# Format and return contents of a variable descriptor
##########
 
 
def dumpdescript(val, d):
 
retval = str(val) + " " * (15 - len(val))
 
for v, p in ((d.Value, 10), (d.Writeable, 7), (d.Type, 17), (d.Default, 10), (d.LegalVals, 10), (d.Min, 10), (d.Max, 10)):
retval += str(v) + (p - len(str(v))) * ' '
 
return retval
 
# End of 'dumpdescript()'
 
##########
# Routine to dump returned values
##########
items.sort()
 
for val in items:
if isdict:
d = data[val]
f = "'%s'"
if d.Type != type(f):
f = "%s"
print val + (15-len(val)) * " ", d.Value, " ", d.Writeable, d.Type, f % d.Default, d.LegalVals, d.Min, d.Max
print dumpdescript(val, data[val])
else:
print val
 
print '\n'