Automatic generation of gtk+ interface




The following quite large article should be read by everyone making
language wrappers, gui builders, corba interfaces for gtk+ and especially
people maintaining gtk+.

I've been playing with an idea that it'd be nice if all the language wrappers
and gtk+'s public interface could be generated from a single specification
describing the information needed to generate all of them completely.
This would require considerably more information about the interface than
what is currently available in the header files.

Few important points of what I'm suggesting:
* Gtk+'s public interface would be generated from same specification than
  every language wrapper or information needed in gui builders.
* The specification would have strict type information which is not all
  used to generate gtk's C interface or any other wrapper.
* It should describe everything users can use.

This would have the following benefits:

* Language wrappers would always be up-to-date and people could generate
  them from any gtk+ version without problems, even when the interface
  has been changed considerably between versions.

* Different kind of automatic code generation, runtime type queries etc
  could be generated from that specification. (like whole corba interface
  to gtk+..) Currently all these are made manually, because gtk.defs is
  always out-of-date and does not have necessary information to generate
  complete interface needed to use gtk+.

* Gtk+'s source would become much simpler and easier to maintain. Also
  several places in gtk+, there's same things implemented in different
  way than in other places in gtk+. Making a common format for describing
  all this would remove the differences and make the interface more
  consistent. Changes in the code generating the framework would affect whole
  gtk+, not only one widget.

* Things like gui builders would be able to use this information to
  generate automatically much of the support of widgets. Currently
  all gui builders, language wrapper and other things describe separately
  gtk+'s interface and given gtk+'s rapid development, all the extra
  stuffs we've build will break each new version.

The sollution is to generate most of gtk+'s public interface with some
kind of macros or meta language that includes ALL interface
information needed in gtk+'s public interface. Of course all language
wrapper authors should be heard before designing the common
specification, so that proper abstraction level and all necessary
information is present.

This kind of thing would rise the abstraction level of gtk's internal
code and I believe it'd make changing gtk+ easier and give benefits of
changes faster to users.

When I introduced this idea in #gimp, Tim Janik said it'd be huge job
and that generating it from C source would be much easier. I disagree,
because the C source code does not include all the necessary
information and C code is too flexible to parse it properly. (someone
makes diffrent kind of interface with C and every wrapper breaks :) =>
we need specialized sollution to match exactly gtk+'s object model and
which has parser already available so that language wrapper can be
implemented just by writing a small text file describing target
languages features.

(There has been talks with some people using gtk--'s signals in other
projects about making the signal system/object model a separate
library - Making it language independent would be important to keep it
consistent on all platforms.)

Any comments/problems with implementing it?

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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