GIntrospection and poppler


I had a look at the GIntrospection work Matthias had done at 

I wanted to try to convert poppler-glib over to use this system.  It is
a fairly small library, with two GObjects, a couple boxed types, and a
bunch of enums.  

I wrote up an quick gidl file which appears to do ... something.  I'm
not 100% sure how to interpret the output yet, and will have to play
with that more later.  I'm posting the xml file to this list in case
anyone else wants to try it on real code.

Here are some issues I had:

 * I needed a constructor for boxed types.  I put a patch in bugzilla to
   add support for this.  Also, return-types in constructors seem to be
   optional.  They should prolly be mandatory.

 * I didn't bother with any of the copy/free functions that go with
   boxed types, as g_boxed_copy/free will work as well.  Does this make
   sense?  Seems like something we can't automate.

 * There was no way to indicate const arguments.  I don't know if it's
   important yet to indicate that some functions modify their input
   while others don't, but it seems like it will be.

 * I had to put <return-type type="void" /> in all functions without a
   return value.  Might be nicer to make this field optional.

 * There's no way to indicate a union.  I suppose I can add a bunch of
   accessor's, but it's pretty obnoxious.  It'll be worse for GdkEvent,

 * The parser is a little fragile.  I spent a good amount of time in the
   debugger tracking down issues in my xml.  It would be really nice to
   have a bunch of functions like sanity_check_boxed() that are called
   after we construct each GIdlNode that catch things like missing
   _get_type() functions.  A more liberal sprinkling of g_asserts would
   be good too.

 * I couldn't indicate what the contents of a GList are.  I vaguely
   recall this went by in the last round of mail, but I don't see it in
   the archives off-hand.  This is a must.

 * I was confused by the relationship between namespace and name.  Eg,
   should I be doing:

  <namespace name="Poppler">
    <object name="Page" ...


  <namespace name="Poppler">
    <object name="Poppler.Page" ...

  I did the former, but it seems like some of the examples do the
  latter.  When I refer to a type in the same module (such as in a
  parameter or return-type), do I need the explicit namespace?  Or can I
  just do eg: <return-type type="Page" />.

 * It seems like we can be more sophisticated with GError.

 * How does it know where in the struct the various fields are?  Or do I
   need to layout the whole struct when defining fields?

 * Finally, I couldn't specify a parent class for objects outside of the
   library (eg, a GObject.GObject).  Tnis seemed to not cause any
   trouble for GdkPixbuf in a return value, but caused it complain when
   the 'parent' attribute was set.


Attachment: poppler.gidl
Description: First cut at poppler gidl file

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]