mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-20 16:55:27 +08:00
Refactoring
- drop _printer suffix from printer classes.
This commit is contained in:

committed by
Chris Johns

parent
a785e254f2
commit
0967a1b679
@@ -245,53 +245,4 @@ class control:
|
||||
|
||||
def name(self):
|
||||
is_string = information.is_string(self._id.api(), self._id._class())
|
||||
return str(name(self.object['name'], is_string))
|
||||
|
||||
|
||||
|
||||
|
||||
class control_printer:
|
||||
|
||||
class iterator:
|
||||
"""Use an iterator for each field expanded from the id so GDB output
|
||||
is formatted correctly."""
|
||||
|
||||
def __init__(self, object):
|
||||
self.object = object
|
||||
self.count = 0
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
self.count += 1
|
||||
if self.count == 1:
|
||||
return self.object.node()
|
||||
elif self.count == 2:
|
||||
return self.object.id()
|
||||
elif self.count == 3:
|
||||
return self.object.name()
|
||||
raise StopIteration
|
||||
|
||||
def to_string(self):
|
||||
return ''
|
||||
|
||||
def __init__(self, object):
|
||||
self.object = control(object)
|
||||
|
||||
@staticmethod
|
||||
def key(i):
|
||||
if i == 0:
|
||||
return 'Node'
|
||||
elif i == 1:
|
||||
return 'id'
|
||||
elif i == 2:
|
||||
return 'name'
|
||||
return 'bad'
|
||||
|
||||
def children(self):
|
||||
counter = itertools.imap (self.key, itertools.count())
|
||||
return itertools.izip (counter, self.iterator(self.object))
|
||||
|
||||
def display_hint (self):
|
||||
return 'struct'
|
||||
return str(name(self.object['name'], is_string))
|
Reference in New Issue
Block a user