Re: [Vala] Fwd: Questions about vapi files writing



Il 17/11/2011 14:54, Daniel Espinosa ha scritto:
2011/11/16 Giulio Paci <giuliopaci interfree it>:
Hi to all,
       I am trying to (re)write Vala bindings for libcurl.

I started following the instruction in this page
http://live.gnome.org/Vala/Bindings
and using information from this page
http://live.gnome.org/Vala/Manual/GIDL%20metadata%20format


Add to your list of useful information:

[1] https://live.gnome.org/Vala/Manual/Attributes

There are lot of annotations you must add to your code in order to do
what you want to.

At last I got a libcurl.gi that was close to what I expected and I tried
to write a metadata file to get an usable vapi file. Unfortunately I
have some problems completing the task.

I have attached an example containing some of the problem I am currently
facing. The libcurl.vapi.target is the desired vapi file, while the
libcurl.vapi is obtained from libcurl.gi and libcurl.metadata using
vapigen (0.14).


Are there GLib bindings of libcurl?

This is because Vala is moving to GIR and is easy to make glibcurl
could generate GObject-Introspection information, using annotations
inside the GLib/C code, then generate the Vala bindigs: Advantage: you
will help lot others languages (not just Vala) to use libcurl like
Python, JavaScript and other with support of GObject Introspection.

Thank you for the suggestion. I will try writing bindings for glibcurl
as soon as I have time, and after I have libcurl bindings working fine.
The problem I can see with glibcurl is that it is not released as a
library but as code that you have to include in your project.

The main issues are:
1) How can I specify that a method (curl_easy_init) is the constructor
of a class (EasyHandle)?
2) How can I instruct vapigen that a function is a method of a class and
not a static function?
3) How can I instruct vapigen to put a cname attibute where needed (e.g.
for the EasyHandle class or the Code enumeration)?
4) How can I handle an enumeration value with a different prefix from
all the other values (e.g.: the last value in the Code enumeration)?
5) Is there any way I can put a static function in a nested namespace
(e.g.: Curl.Global.init())?


Most of this questions can be solved by see at Attributes is [1]
above. I'm not realy sure how to add that annotations using metadata,
but you can add custom code instead.

The Attributes page was already one of my sources. Unfortunately most of
the annotations have a meaning only inside vala/vapi files and not in
the metadata file. If there is no better way, I think I am going to fix
the vapi file by hand.

Bests,
        Giulio.



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