Re: [ANN] ocaml-gir 0.9 alpha - binding generator for glib2-based libs

Adrien <[email protected]> Mon, 12 Oct 2009 11:51:56 +0200
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Hi,

I managed to sort this after finally sleeping than I had been. Well, I
was still a bit tired and solved the wrong problem: it compiles but
some of the generated code is never used. Anyway, I found
iconview_foreach and used it as a template.

Over the week I've also fixed a few other bugs which now let
webkit-gtk and dbus-glib binding compile and work (at least partially)
and made an -alpha2 release. I've made a screenshot for a 12-line
browser with webkit-gtk[1] (12 lines, that's why it has absolutely no
bar or menu whatsoever). There are roughly 1700 lines of code
generated for the webkit bindings and 1000 for the dbus ones.

I don't know if I had said that but the usage is: run ./me.sh , it
will create bindings-directory/WebKit-bindings and
bindings-directory/DBus-bindings. Have a look in the generated folder,
everything is there.
Of course, you will need the corresponding libraries and headers. This
has been tested successfully on slackware and debian.

As last time, the project is hosted on git at the ocamlforge[2] and a
tarball is available[3].

There is one problem for the webkit-gtk bindings however: webkit-gtk
now requires that "the thread system is initialized" which is done
through a call to g_init_thread() which isn't currently available in
lablgtk2 (I've seen some commented code reference to it however).
Would it be possible that this function is added in future releases?

[1]: http://omploader.org/vMmoyYg/ua.png
[2]: http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=ocaml-gir/ocaml-gir.git;a=summary
[3]: http://forge.ocamlcore.org/frs/?group_id=73&release_id=186

 ---

Adrien Nader

On 04/10/2009, Adrien <[email protected]> wrote:
> ocaml-gir is an automated binding generator for libaries based on
> glib2, using the parsing done by gobject-intropesction[1] (although it
> sucks and I may just diss it).
>
> It is almost able to write bindings for webkit-gtk, dbus-glib and
> other libraries. With minor editing (commenting out functions that
> couldn't work), I've been able to write a small working browser using
> webkit-gtk.
>
> THe project is hosted on forge.ocamlcore.org . A tarball is available
> [2] and git too [3], as well as gitweb [4] (development is done on the
> master branch btw). The logic of the code is basically: ocamlgir.ml
> parses the .gir (xml) file produced by g-ir-scanner and type.ml holds
> functions to translate from the xml tree to a nicer format and finally
> there is a .ml file for each file that has to be created (c.ml,
> gtk.ml, g.ml, c_tags.ml, h.ml, ...). girstring.ml is a module to
> change the casing of a string: FooBarBlaBla <-> FOO_BAR_BLA_BLA <->
> foo_bar_bla_bla.
>
> What is currently missing is signals/callbacks, inheriting between
> libraries (webkit-gtk depends on libsoup) and something about
> callbacks I'm not sure how I could do and which is the reason I am
> writing this a bit before ocaml-gir is ready.
>
> For instance, a function takes a DBusGProxyCallNotify* which is
> defined as follows:
>     typedef void (* DBusGProxyCallNotify)
>                         (DBusGProxy *proxy, DBusGProxyCall *call_id,
> void *user_data);
> How should I write the C conversion macro to/from value?
> Thanks.
>
> And just a word about gobject-introspection: I hate it. =)
>
>
> [1] http://live.gnome.org/GObjectIntrospection
> [2] http://forge.ocamlcore.org/frs/?group_id=73&release_id=180
> [3] http://git.ocamlcore.org/ocaml-gir/ocaml-gir.git
> [4]
> http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=ocaml-gir/ocaml-gir.git;a=summary
>
>
>  ---
>
> Adrien Nader
>