This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [python] fully unify CLI and MI pretty printers


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
> arguments.
> 
> 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
> pass.
> 
> 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 
install_default_visualizer.

- Volodya



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]