[Gnome-bindings] defs stuff



No one seems to have posted anything to this list, so I thought I may as
well start.

As some of you probably know, I think the .defs files used by a number of
language bindings is a good way of keeping a set of bindings up to date,
and maybe making different language bindings consistent.  Of course there
will be some functions that can't be easily auto wrapped, but it is easy
to add some sort of override ability to the code generator.

Havoc came up with a new defs file format, which is an improvement over
the previous format as it provides the information needed to construct an
object oriented set of bindings in a more explicit form.

I have been working on some code to use this new format (as Havoc has been
a bit busy).  It is available in the codegen directory of pygtk on the
extension-class branch.  Grab it with:
  cvs -z3 get -r extension-class pygtk

There is a C header file -> defs file converter, which makes starting off
the .defs files easier.  As the C header files do not supply all the
information a defs file might need, I wrote a simple merge utility.  The
idea is to take the non generated portions of a defs file (eg. which
fields of an object are public, which function is the constructor for a
particular object, extra flags for function parameters), and moves them
to another defs file.  The idea is that you could generate a new .defs
file from newer headers and then merge the modifications over to the new
file.

The rest of the stuff is mainly my python wrapper code generator, so is
probably not of interest to other binding authors.  There were a few
additions to Havoc's last draft for the defs format that I added:
  - a (null-ok) flag for function arguments to specify if it is okay to
    pass a null (or a None or nil or whatever) for this argument
  - a (default "defaultval") flag for function arguments, specifying a
    default value if the argument is omitted.

James.

--
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






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