This is the mail archive of the
mailing list for the Archer project.
Re: [python] fully unify CLI and MI pretty printers
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: archer at sourceware dot org
- Date: Thu, 06 Nov 2008 23:57:28 +0300
- Subject: Re: [python] fully unify CLI and MI pretty printers
- References: <firstname.lastname@example.org>
Tom Tromey wrote:
> This patch fully unifies the CLI and MI pretty printing code. It
> removes the ability to use a plain function to pretty-print from the
> CLI (if you really, really want this, it is trivial to recreate using
> a delegating class).
> This patch also changes how these objects are instantiated and called.
> Now, the value to be printed is passed as an argument to the object's
> constructor. Methods like children and to_string are given no
> Finally, cli_pretty_printers and mi_pretty_printers are gone, replaced
> with a single pretty_printers array. This maps regular expressions to
> single argument functions taking a value and returning a printer
> object (constructors work fine here of course).
> I updated the docs and the test suite. All the Python tests still
> I've also attached a rewrite of my libstdc++ pretty-printers. Please
> ignore the deque printer, it is incomplete and bogus. I tested most
> of the other ones.
I'm looking at this code:
+ /* Change the default visualizer, if needed, before installing
+ the new value. This ensures that we instantiate the correct
+ class. */
+ if (type_changed)
+ install_default_visualizer (*varp, value_type (new));
I think that if type_changed is 1, then old varobj is
already deleted, new one is created and assigned to *varp, and therefore
the varobj already has the new type. And then, value_type is equal to
(*varp)->type, and there's no need to add new parameter to