GNOME Bugzilla – Bug 91509
missing wrappers in pangomm
Last modified: 2004-12-22 21:47:04 UTC
The pangomm API is currently incomplete. Lots of c structures are used directly in our code instead of creating proper wrapper classes. I made some effort to improve the situation. The work should be complete apart from missing documentation and thorough testing. I split it into a couple of patches so that parts can be treated (almost) independently. Please read and comment. Note: PangoEngineXYZ is not wrapped because the API seems to be mainly used to add new pango backends and not useful for userland. The definitions of the c structures and functions are #ifdefed out by default.
Created attachment 10662 [details] [review] Some corrections in members.m4 and reorganisation of convert_pango.m4 that goes along with the following patches.
Created attachment 10663 [details] New wrappers: simple data types collected from pango/pango-types.h and other files.
Created attachment 10664 [details] New wrappers: Pango::Item, Pango::Analysis
Created attachment 10665 [details] New wrappers: Pango::Glyph*
Created attachment 10666 [details] New wrappers: Pango::Attribute, Pango::Attr*, Pango::AttrIter
Created attachment 10667 [details] [review] Reflect the changes in other existing files.
Note2: The xyz.tar files contain a xyz.diff file (with the ChangeLog entry and changes to existing files) and new files.
1. Please put separate classes in separate .hg|.ccg files, instead of >1 in types.hg|.ccg. 2. Please tell me what file formats are used here. Try to use the filename in the description. I don't like guessing what is a diff, what is a .tar, what is a .tar.gz, what is a .cc, etc.
Sorry, I forgot that bugzilla is not very verbose about attachments... Anyway, I reattach all patches to suit your first point apart from the first attachment (id=10663), which is a .diff file.
Created attachment 10676 [details] pangomm-rectangle.tar: Add new wrapper Pango::Rectangle.
Created attachment 10677 [details] pangomm-language.tar: Add new wrapper Pango::Language.
Created attachment 10678 [details] pangomm-color.tar: Add new wrapper Pango::Color.
Created attachment 10679 [details] pangomm-item.tar: Add new wrappers Pango::Analysis, Pango::Item
Created attachment 10680 [details] pangomm-glyph.tar: Add new wrappers Pango::Glyph*
Created attachment 10681 [details] pangomm-attr.tar: Add new wrappers Pango::Attribute, Pango::AttrXYZ, Pango::AttrIter
Created attachment 10682 [details] [review] pangomm-use_new_wrappers.diff: Reflect changes in existing files pango/src/*
Why on earth did you submit these all as separate patches, when they clearly depend on each other? It just makes my life difficult. I give up trying to make them all work. Please submit one big patch. I am trying to get cvs write access for you but I can't find a cvsmaster now.
Created attachment 10689 [details] pangomm-all-in-one.tar.gz: One big package that holds all changes.
That's much easier, but: ../../glib/glibmm/slisthandle.h: In method `void Glib::SListHandle<T, Tr>::SListHandle () [with T = Pango::Attribute, Tr = Glib::Container_Helpers::TypeTraits<Pango::Attribute>]': attriter.cc:130: instantiated from here ../../glib/glibmm/slisthandle.h:296: no matching function for call to `Pango::Attribute::Attribute (void *&)' ../../pango/pangomm/attributes.h:146: candidates are: Pango::Attribute::Attribute () ../../pango/pangomm/attributes.h:147: Pango::Attribute::Attribute (const Pango::Attribute &) ../../pango/pangomm/attributes.h:148: Pango::Attribute::Attribute (PangoAttribute *, bool = true) make[4]: *** [attriter.lo] Error 1 make[4]: Leaving directory `/gnome/head/cvs/c++/gtkmm-1.3/pango/pangomm' make[3]: *** [all-recursive] Error 1
I can't reproduce this error with my compiler version (gcc 2.95.3) but I'm glad that it did happen to you because I chose the wrong return type for Pango::AttrIter::get_extra_attrs(): it must be Glib::SListHandle<Pango::Attribute*> (Glib::OWNERSHIP_DEEP) instead of Glib::SListHandle<Pango::Attribute> (Glib::OWNERSHIP_SHALLOW)!
Created attachment 10710 [details] pangomm-all-in-one.tar.gz (v2): attriter.hg corrected.
Now I get: ../../glib/glibmm/listhandle.h: In method `void Glib::ListHandle<T, Tr>::ListHandle () [with T = Pango::Item, Tr = Glib::Container_Helpers::TypeTraits<Pango::Item>]': context.cc:49: instantiated from here ../../glib/glibmm/listhandle.h:297: no matching function for call to `Pango::Item::Item (void *&)' ../../pango/pangomm/item.h:89: candidates are: Pango::Item::Item (PangoItem *, bool = true) ../../pango/pangomm/item.h:91: Pango::Item::Item (const Pango::Item &) gmake[4]: *** [context.lo] Error 1 Also, I don't understand why you have added the Pango:: namespace prefix to some method parameters, and removed the conversion for non-prefixed types. For instance, in Layout. Also, in Layout, and possibly in other files, please try to use C++ rather than C type names in the documentation.
1. I'm really sorry that you're having those problems compiling the patch. I just don't get those errors so I have to fix things from your compiler output. I'll investigate the latest problem at once. 2. I added Pango:: namespace prefix because I didn't see any pattern where it was left out. In some function definitions the first parameter type would be prefixed with Pango::, the second would not. So I decided to unify the parameter lists along with my other changes. 3. I try to use c++ names everywhere but since I plan to review and complete the documentation of Pango anyway I was not very careful.
Created attachment 10717 [details] pangomm-all-in-one.tar.gz (v3): fix context.{hg,ccg} - hopefully my compiler didn't miss another obvious error ...
Sorry, I still see the same error. 2. I would prefer to standardise on not having the prefix unless it is necessary. We can do that later.
Created attachment 10726 [details] pangomm-all-in-one.tar.gz (v3, really!): grr... wrong diff file last time...
Created attachment 10728 [details] pangomm-all-in-one.tar.gz (v4): get rid of Pango:: prefix, add more class descriptions, wrap two methods in Pango::Fontset
Applied. You're search-replace in convert_pango.m4 was quite brutal and broke lots of things, but i fixed that. You need to be more careful when committing directly. That's in the queue apparently. Thanks for making such a big effort. Maybe you could update api_status.txt to show us what you think needs to be done.