Re: Cooperating on .defs API specifications
- From: Andreas Rottmann <a rottmann gmx at>
- To: James Henstridge <james daa com au>
- Cc: Owen Taylor <otaylor redhat com>, Murray Cumming <murrayc murrayc com>, GNOME Language Bindings <language-bindings gnome org>, guile-gtk discussions <guile-gtk-general gnu org>, shiro acm org, bigloo-lib-devel lists sourceforge net
- Subject: Re: Cooperating on .defs API specifications
- Date: Wed, 31 Mar 2004 12:48:09 +0200
James Henstridge <james daa com au> writes:
> On 31/03/2004 3:52 AM, Andreas Rottmann wrote:
>
>>Why not have .defs files, and generate the binary info from them? The
>>.defs files are already there, and they contain more information than
>>the headers do (well, comment parsing might change that, but you could
>>create comments from the .defs files :)). Just an idea...
>>
> For simple cases, the defs files contain enough information. For the
> more complex cases, they lack some information that would be needed
> for full introspection. Some examples are:
>
> * what types do (GList *) arguments and return values hold? How
> should a binding release a (GList *) return value? (in various
> parts of GTK and Gnome, the answer is "free all members then the
> list", "free the list" and "do nothing")
>
In guile-gobject, we use "Glist*-of-FOO" and caller-owns-return to
solve this (well the return value problem only partially). Examples:
(define-method set_popdown_strings
(of-object "GtkCombo")
(c-name "gtk_combo_set_popdown_strings")
(return-type "none")
(parameters
'("GList*-of-gchar*" "strings")
)
)
(define-method copy
(of-object "GtkIconSet")
(c-name "gtk_icon_set_copy")
(return-type "GtkIconSet*")
(caller-owns-return #t)
)
> * Some functions take an array and a length arguments. It would be
> good to link these together (for most languages, we should be able
> to omit the length arguments, since their list/array types know
> their length).
>
Indeed. We could "invent" a new parameter type to describe this.
> * Is an (int *) argument an array of ints being passed in, an array
> of ints that will be modified (inout), or a pointer to a single
> int being used as an out argument?
>
One could add specifiers to those value's type strings,
e.g. int*-in-out.
Andy
--
Andreas Rottmann | Rotty ICQ | 118634484 ICQ | a rottmann gmx at
http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
Latein ist das humanoide Äquivalent zu Fortran.
-- Alexander Bartolich in at.linux
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]