def list(self, **type):
"""List all the members within the structure.
Search type can be identified by providing a named argument.
like = glob match
regex = regular expression
index = particular index
identifier = particular id number
predicate = function predicate
"""
res = __builtin__.list(self.iterate(**type))
escape = repr
maxindex = max(__builtin__.map(utils.compose(operator.attrgetter('index'),"{:d}".format,len), res) or [1])
maxoffset = max(__builtin__.map(utils.compose(operator.attrgetter('offset'),"{:x}".format,len), res) or [1])
maxsize = max(__builtin__.map(utils.compose(operator.attrgetter('size'),"{:x}".format,len), res) or [1])
maxname = max(__builtin__.map(utils.compose(operator.attrgetter('name'), escape, len), res) or [1])
maxtype = max(__builtin__.map(utils.compose(operator.attrgetter('type'), repr, len), res) or [1])
for m in res:
print "[{:{:d}d}] {:>{:d}x}:+{:<{:d}x} {:<{:d}s} {:{:d}s} (flag={:x},dt_type={:x}{:s}){:s}".format(m.index, maxindex, m.offset, int(maxoffset), m.size, maxsize, escape(m.name), int(maxname), m.type, int(maxtype), m.flag, m.dt_type, '' if m.typeid is None else ",typeid={:x}".format(m.typeid), " // {:s}".format(m.comment) if m.comment else '')
return
评论列表
文章目录