diff options
author | Tom Tromey <tromey@redhat.com> | 2012-02-14 20:38:39 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2012-02-14 20:38:39 +0000 |
commit | d25b1e3a80b442b145cbcd57c234393a70ec4605 (patch) | |
tree | 1fa0e0f794e19c0319ce2d56c75a4b04dfbbe30a /libstdc++-v3/python | |
parent | 7a07ae52847ee08f47746f4b7cddd394839a3d6e (diff) | |
download | gcc-d25b1e3a80b442b145cbcd57c234393a70ec4605.zip gcc-d25b1e3a80b442b145cbcd57c234393a70ec4605.tar.gz gcc-d25b1e3a80b442b145cbcd57c234393a70ec4605.tar.bz2 |
cxx11.cc (main): Add new tests.
* testsuite/libstdc++-prettyprinters/cxx11.cc (main): Add new
tests.
* python/libstdcxx/v6/printers.py (Tr1HashtableIterator.__init__):
Rewrite.
(Tr1HashtableIterator.update): Remove.
(Tr1HashtableIterator.next): Rewrite.
From-SVN: r184233
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r-- | libstdc++-v3/python/libstdcxx/v6/printers.py | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index f47da61..76c54b1 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -610,38 +610,18 @@ class StdStringPrinter: class Tr1HashtableIterator: def __init__ (self, hash): - self.count = 0 - self.n_buckets = hash['_M_element_count'] - if self.n_buckets == 0: - self.node = False - else: - self.bucket = hash['_M_buckets'] - self.node = self.bucket[0] - self.update () + self.node = hash['_M_before_begin']['_M_nxt'] + self.node_type = find_type(hash.type, '_Node').pointer() def __iter__ (self): return self - def update (self): - # If we advanced off the end of the chain, move to the next - # bucket. - while self.node == 0: - self.bucket = self.bucket + 1 - self.node = self.bucket[0] - - # If we advanced off the end of the bucket array, then - # we're done. - if self.count == self.n_buckets: - self.node = False - else: - self.count = self.count + 1 - def next (self): - if not self.node: + if self.node == 0: raise StopIteration - result = self.node.dereference()['_M_v'] - self.node = self.node.dereference()['_M_next'] - self.update () + node = self.node.cast(self.node_type) + result = node.dereference()['_M_v'] + self.node = node.dereference()['_M_nxt'] return result class Tr1UnorderedSetPrinter: |