[897] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: A description format for Gtk features

daemon@ATHENA.MIT.EDU (Federico Mena)
Thu Sep 4 14:39:59 1997

Date: Thu, 4 Sep 1997 13:35:02 -0500
From: Federico Mena <federico@nuclecu.unam.mx>
To: gtk-list@redhat.com
In-reply-to: <87rab5eysn.fsf@zagadka.ping.de> (message from Marius Vollmer on
	04 Sep 1997 20:09:28 +0200)
Reply-to: federico@nuclecu.unam.mx
Resent-From: gtk-list@redhat.com

>  Therefore I'd like to know how much extra burden you would tolerate
>  for the sake of robust high-level bindings.

I think using a description file is fine.  If the thing can be made to
generate C code from the description file automatically, it would
rock.

>  Would you maintain such a description file?  Even if you don't use a
>  high-level language yourself?

Definitely.  "I'd rather write programs to write programs than write
programs" (Dick Sites) :-)

>  A typical function description could look like:
[example snipped]

I have slowly (read, *slowly*) been working on a C boilerplate code
generator for creating new Gtk classes, in Scheme.  I have been going
slowly because string processing in Scheme is not that nice, and I
have done some things the hard way just to practice my Scheme :-)  

The idea is to automatically generate most of the `standard' code
required to make a new Gtk class (header file, class initialization
code, signal marshallers, etc.).  My current definition file syntax
looks like this:

(class-from 'GtkHBox
	    'GtkToolbar
	    (overrides-signal "add")
	    (new-signal "foo"
			'(GTK-RUN-FIRST GTK-RUN-NO-RECURSE)
			'(GTK-ARG-NONE "void")
			'((GTK-ARG-POINTER "GtkButton *" "button")))
	    (new-signal "bar"
			'(GTK-RUN-LAST)
			'(GTK-ARG-INT "gint")
			'((GTK-ARG-POINTER "GtkButton *" "button")
			  (GTK-ARG-LONG "glong" "squish"))))

I'm not yet finished with the code generator, so it's likely that some
of that syntax will change.  But the point is that it *is* convenient
to generate C code from the description file.  I think this thingy
could be nicely integrated with your own idea, and a lot of the grunt
work of making Gtk classes and language bindings would simply go away.

>  What do you think?

Great idea! :-)

  Quartic

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post