Re: [Vala] GObject-introspection and vapi



Hello,

Returning the thread to the list, since it might be useful for other
people too.

On Mon, April 12, 2010 23:24, Marc-André Lureau wrote:
Did you succeed in making a vapi for gobject-introspection?

I did, at least for the bits I needed. I've placed it on gitorious:
http://gitorious.org/valadate/valadate/blobs/master/vapi/gobject-introspection-1.0.vapi

(link to raw data:
http://gitorious.org/valadate/valadate/blobs/raw/master/vapi/gobject-introspection-1.0.vapi)

Unfortunately I wrote it manually. It seemed less work than

1) Is the .gir expected to be equivalent to the .vapi, i.e. is it
  supposed to contain all information needed to create the .vapi
  (if it was correct, which it isn't, but that's another matter
  -- but it would mean I should be fixing the .gir or the annotations
  they use to generate it).

Well, it should be (since it's supposed to allow using all functionality
of the library), if it was correct. However, many of existing .gir files
are not correct and since the format is not properly documented either
it's sometimes hard to guess how some of it's constructs should properly
translate to .vapi.

2) Is the .gir documented somewhere? I tried looking at the
  GObjectIntrospection web, but didn't find it. I only found
  documentation
  of the annotations. Which does not tell me important things like how
  to tell the generator that the structs it sees are actually gobjects
  (there is a bunch of things annotated as <record> that are gobjects
  when I look at the header).

Nothing much really. I was eventually able to use the .gir file generated
by valac by comparing it to the .vapi file for the same code, which was
enough for what I needed at that point.

3) I don't think a <record> should be treated as struct, because the
  GLib-2.0.gir from GI repository uses that to annotate all the
  non-gobject classes like IOChannel, which are reference types.
  So what is the correct way to handle them? (guess I can look into
  glib-2.0.vapi, right?)

The problem is that many .gir files out there are no good, the one for
gobject-introspection itself being the worst offender. This makes it kind
of hard to guess what is correct interpretation of some .gir markup.

-- 
                                        - Jan Hudec <bulb ucw cz>




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