]>
Commit | Line | Data |
---|---|---|
6ed6bacf AM |
1 | 2010-06-01 Chris Moller <cmoller@redhat.com> |
2 | ||
3 | * python/libstdcxx/v6/printers.py (StdVectorPrinter): Add | |
4 | detection for matrices as nested vectors. | |
5 | ||
6 | Index: libstdc++-v3/python/libstdcxx/v6/printers.py | |
7 | =================================================================== | |
8 | --- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (revision 159937) | |
9 | +++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (working copy) | |
10 | @@ -19,6 +19,9 @@ | |
11 | import itertools | |
12 | import re | |
13 | ||
14 | +vector_sig = 'std::vector' | |
15 | +vector_regex = re.compile('^' + vector_sig + '<.*>$') | |
16 | + | |
17 | class StdPointerPrinter: | |
18 | "Print a smart pointer of some kind" | |
19 | ||
20 | @@ -186,7 +189,13 @@ | |
21 | % (self.typename, int (finish - start), int (end - start))) | |
22 | ||
23 | def display_hint(self): | |
24 | - return 'array' | |
25 | + itype0 = self.val.type.template_argument(0) | |
26 | + itag = itype0.tag | |
27 | + if itag and re.match(vector_regex, itag): | |
28 | + rc = 'matrix' | |
29 | + else: | |
30 | + rc = 'array' | |
31 | + return rc | |
32 | ||
33 | class StdVectorIteratorPrinter: | |
34 | "Print std::vector::iterator" | |
35 | @@ -692,7 +701,7 @@ | |
36 | pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val) | |
37 | pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val) | |
38 | pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter | |
39 | - pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val) | |
40 | + pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val) | |
41 | # vector<bool> | |
42 | ||
43 | # Printer registrations for classes compiled with -D_GLIBCXX_DEBUG. |