Lines 51-57
Link Here
|
51 |
# anything fancier here. |
51 |
# anything fancier here. |
52 |
field = typ.fields()[0] |
52 |
field = typ.fields()[0] |
53 |
if not field.is_base_class: |
53 |
if not field.is_base_class: |
54 |
raise ValueError, "Cannot find type %s::%s" % (str(orig), name) |
54 |
raise ValueError("Cannot find type %s::%s" % (str(orig), name)) |
55 |
typ = field.type |
55 |
typ = field.type |
56 |
|
56 |
|
57 |
class SharedPointerPrinter: |
57 |
class SharedPointerPrinter: |
Lines 97-103
Link Here
|
97 |
def __iter__(self): |
97 |
def __iter__(self): |
98 |
return self |
98 |
return self |
99 |
|
99 |
|
100 |
def next(self): |
100 |
def __next__(self): |
101 |
if self.base == self.head: |
101 |
if self.base == self.head: |
102 |
raise StopIteration |
102 |
raise StopIteration |
103 |
elt = self.base.cast(self.nodetype).dereference() |
103 |
elt = self.base.cast(self.nodetype).dereference() |
Lines 144-150
Link Here
|
144 |
def __iter__(self): |
144 |
def __iter__(self): |
145 |
return self |
145 |
return self |
146 |
|
146 |
|
147 |
def next(self): |
147 |
def __next__(self): |
148 |
if self.base == 0: |
148 |
if self.base == 0: |
149 |
raise StopIteration |
149 |
raise StopIteration |
150 |
elt = self.base.cast(self.nodetype).dereference() |
150 |
elt = self.base.cast(self.nodetype).dereference() |
Lines 198-204
Link Here
|
198 |
def __iter__(self): |
198 |
def __iter__(self): |
199 |
return self |
199 |
return self |
200 |
|
200 |
|
201 |
def next(self): |
201 |
def __next__(self): |
202 |
count = self.count |
202 |
count = self.count |
203 |
self.count = self.count + 1 |
203 |
self.count = self.count + 1 |
204 |
if self.bitvec: |
204 |
if self.bitvec: |
Lines 276-295
Link Here
|
276 |
# Set the actual head to the first pair. |
276 |
# Set the actual head to the first pair. |
277 |
self.head = self.head.cast (nodes[0].type) |
277 |
self.head = self.head.cast (nodes[0].type) |
278 |
elif len (nodes) != 0: |
278 |
elif len (nodes) != 0: |
279 |
raise ValueError, "Top of tuple tree does not consist of a single node." |
279 |
raise ValueError("Top of tuple tree does not consist of a single node.") |
280 |
self.count = 0 |
280 |
self.count = 0 |
281 |
|
281 |
|
282 |
def __iter__ (self): |
282 |
def __iter__ (self): |
283 |
return self |
283 |
return self |
284 |
|
284 |
|
285 |
def next (self): |
285 |
def __next__ (self): |
286 |
nodes = self.head.type.fields () |
286 |
nodes = self.head.type.fields () |
287 |
# Check for further recursions in the inheritance tree. |
287 |
# Check for further recursions in the inheritance tree. |
288 |
if len (nodes) == 0: |
288 |
if len (nodes) == 0: |
289 |
raise StopIteration |
289 |
raise StopIteration |
290 |
# Check that this iteration has an expected structure. |
290 |
# Check that this iteration has an expected structure. |
291 |
if len (nodes) != 2: |
291 |
if len (nodes) != 2: |
292 |
raise ValueError, "Cannot parse more than 2 nodes in a tuple tree." |
292 |
raise ValueError("Cannot parse more than 2 nodes in a tuple tree.") |
293 |
|
293 |
|
294 |
# - Left node is the next recursion parent. |
294 |
# - Left node is the next recursion parent. |
295 |
# - Right node is the actual class contained in the tuple. |
295 |
# - Right node is the actual class contained in the tuple. |
Lines 353-359
Link Here
|
353 |
def __len__(self): |
353 |
def __len__(self): |
354 |
return int (self.size) |
354 |
return int (self.size) |
355 |
|
355 |
|
356 |
def next(self): |
356 |
def __next__(self): |
357 |
if self.count == self.size: |
357 |
if self.count == self.size: |
358 |
raise StopIteration |
358 |
raise StopIteration |
359 |
result = self.node |
359 |
result = self.node |
Lines 414-422
Link Here
|
414 |
def __iter__(self): |
414 |
def __iter__(self): |
415 |
return self |
415 |
return self |
416 |
|
416 |
|
417 |
def next(self): |
417 |
def __next__(self): |
418 |
if self.count % 2 == 0: |
418 |
if self.count % 2 == 0: |
419 |
n = self.rbiter.next() |
419 |
n = next(self.rbiter) |
420 |
n = n.cast(self.type).dereference()['_M_value_field'] |
420 |
n = n.cast(self.type).dereference()['_M_value_field'] |
421 |
self.pair = n |
421 |
self.pair = n |
422 |
item = n['first'] |
422 |
item = n['first'] |
Lines 456-463
Link Here
|
456 |
def __iter__(self): |
456 |
def __iter__(self): |
457 |
return self |
457 |
return self |
458 |
|
458 |
|
459 |
def next(self): |
459 |
def __next__(self): |
460 |
item = self.rbiter.next() |
460 |
item = next(self.rbiter) |
461 |
item = item.cast(self.type).dereference()['_M_value_field'] |
461 |
item = item.cast(self.type).dereference()['_M_value_field'] |
462 |
# FIXME: this is weird ... what to do? |
462 |
# FIXME: this is weird ... what to do? |
463 |
# Maybe a 'set' display hint? |
463 |
# Maybe a 'set' display hint? |
Lines 534-540
Link Here
|
534 |
def __iter__(self): |
534 |
def __iter__(self): |
535 |
return self |
535 |
return self |
536 |
|
536 |
|
537 |
def next(self): |
537 |
def __next__(self): |
538 |
if self.p == self.last: |
538 |
if self.p == self.last: |
539 |
raise StopIteration |
539 |
raise StopIteration |
540 |
|
540 |
|
Lines 572-578
Link Here
|
572 |
|
572 |
|
573 |
size = self.buffer_size * delta_n + delta_s + delta_e |
573 |
size = self.buffer_size * delta_n + delta_s + delta_e |
574 |
|
574 |
|
575 |
return '%s with %d elements' % (self.typename, long (size)) |
575 |
return '%s with %d elements' % (self.typename, int (size)) |
576 |
|
576 |
|
577 |
def children(self): |
577 |
def children(self): |
578 |
start = self.val['_M_impl']['_M_start'] |
578 |
start = self.val['_M_impl']['_M_start'] |
Lines 627-633
Link Here
|
627 |
def __iter__ (self): |
627 |
def __iter__ (self): |
628 |
return self |
628 |
return self |
629 |
|
629 |
|
630 |
def next (self): |
630 |
def __next__ (self): |
631 |
if self.node == 0: |
631 |
if self.node == 0: |
632 |
raise StopIteration |
632 |
raise StopIteration |
633 |
node = self.node.cast(self.node_type) |
633 |
node = self.node.cast(self.node_type) |
Lines 655-662
Link Here
|
655 |
return '[%d]' % i |
655 |
return '[%d]' % i |
656 |
|
656 |
|
657 |
def children (self): |
657 |
def children (self): |
658 |
counter = itertools.imap (self.format_count, itertools.count()) |
658 |
counter = map (self.format_count, itertools.count()) |
659 |
return itertools.izip (counter, Tr1HashtableIterator (self.hashtable())) |
659 |
return zip (counter, Tr1HashtableIterator (self.hashtable())) |
660 |
|
660 |
|
661 |
class Tr1UnorderedMapPrinter: |
661 |
class Tr1UnorderedMapPrinter: |
662 |
"Print a tr1::unordered_map" |
662 |
"Print a tr1::unordered_map" |
Lines 688-698
Link Here
|
688 |
return '[%d]' % i |
688 |
return '[%d]' % i |
689 |
|
689 |
|
690 |
def children (self): |
690 |
def children (self): |
691 |
counter = itertools.imap (self.format_count, itertools.count()) |
691 |
counter = map (self.format_count, itertools.count()) |
692 |
# Map over the hash table and flatten the result. |
692 |
# Map over the hash table and flatten the result. |
693 |
data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.hashtable()))) |
693 |
data = self.flatten (map (self.format_one, Tr1HashtableIterator (self.hashtable()))) |
694 |
# Zip the two iterators together. |
694 |
# Zip the two iterators together. |
695 |
return itertools.izip (counter, data) |
695 |
return zip (counter, data) |
696 |
|
696 |
|
697 |
def display_hint (self): |
697 |
def display_hint (self): |
698 |
return 'map' |
698 |
return 'map' |
Lines 709-715
Link Here
|
709 |
def __iter__(self): |
709 |
def __iter__(self): |
710 |
return self |
710 |
return self |
711 |
|
711 |
|
712 |
def next(self): |
712 |
def __next__(self): |
713 |
if self.base == 0: |
713 |
if self.base == 0: |
714 |
raise StopIteration |
714 |
raise StopIteration |
715 |
elt = self.base.cast(self.nodetype).dereference() |
715 |
elt = self.base.cast(self.nodetype).dereference() |
Lines 764-770
Link Here
|
764 |
# A small sanity check. |
764 |
# A small sanity check. |
765 |
# FIXME |
765 |
# FIXME |
766 |
if not self.compiled_rx.match(name + '<>'): |
766 |
if not self.compiled_rx.match(name + '<>'): |
767 |
raise ValueError, 'libstdc++ programming error: "%s" does not match' % name |
767 |
raise ValueError('libstdc++ programming error: "%s" does not match' % name) |
768 |
printer = RxPrinter(name, function) |
768 |
printer = RxPrinter(name, function) |
769 |
self.subprinters.append(printer) |
769 |
self.subprinters.append(printer) |
770 |
self.lookup[name] = printer |
770 |
self.lookup[name] = printer |