Re: [Vala] VAPI-Bindings to obscure c-types.
- From: Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
- To: Al Thomas <astavale yahoo co uk>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] VAPI-Bindings to obscure c-types.
- Date: Mon, 5 Dec 2016 13:44:25 -0500
There's a rank table sitting somewhere and I'm always looking for it. It
would be really nice to add it to
https://wiki.gnome.org/Projects/Vala/Manual/Attributes
If you want some more examples of numeric datatypes, I also have defined a
couple in
https://github.com/arteymix/numeric-glib/blob/master/src/numeric-glib-1.0.vapi
2016-12-05 13:16 GMT-05:00 Al Thomas <astavale yahoo co uk>:
________________________________
From: Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
Sent: Monday, 5 December 2016, 17:30
Subject: Re: [Vala] VAPI-Bindings to obscure c-types.
You could also use a [FloatingType] declaration and not mess with
pre-processor directives.
[FloatingType]
public struct dReal {}
Nice solution. I presume [FloatingType] allows for the struct to be
initialized with a real literal, whereas just using [SimpleType] means it
has to use the struct syntax. So
dReal x = 1.23456;
instead of
dReal x = { 1.23456 );
[SimpleType]
[CCode (cname = "dReal", has_type_id = false)]
public struct dReal : float {
}
In terms of Vala syntax I think [FloatingType], [IntegerType] and
[BooleanType] enable the use of the relevant Vala literal syntax when
initializing the struct. I'm not so sure about the implicit casting rules
in Vala, is the rank detail required? There is also a width detail.
In terms of the C code generated the glib-2.0.vapi also has CCode details
for 'default_value' and for doubles 'type_signature'. Not sure how relevant
they are.
It would be nice to get my understanding of [FloatingType], [IntegerType]
and [BooleanType] nailed and I'll try updating the Simple Types section of
the Legacy Bindings doc.
Al
--
Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web
*Mon blog:* arteymix.github.io
*Mon projet de coopérative:* pittoresque.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex&search=0x1CCFC3A2B1AD6EA5>
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]