[plt-scheme] GTK Hooks for drscheme?

From: Daniel Silva (daniel.silva at gmail.com)
Date: Fri Sep 3 06:05:19 EDT 2004

On Fri, 3 Sep 2004 05:48:22 -0400, Neil W. Van Dyke
<neil at neilvandyke.org> wrote:
> Daniel Silva <daniel.silva at gmail.com> writes at 05:17 03-Sep-2004 -0400:
> > http://lists.gnome.org/archives/language-bindings/2004-August/msg00009.html
> 
> My generator actually used an analogue of the "add-type-rules!" that
> Andreas Rottman mentions, which seemed to cover most all of the cases,
> though I wasn't fully happy with that.

How many extra rules did you have to write?
 
> I actually never cared whether functions like "gtk_list_store_insert"
> you mention mutated their struct-pointer arguments, since I thought it
> should just work with the obvious internal representation, but perhaps
> I'm missing something?

In the case of gtk_list_store_insert, this is how you use the function in C:

GtkListStore* store_ptr = ..... some pointer .....;
GtkTreeIter iter;  // <-- uninitialized memory block

gtk_list_store_insert(store_ptr, &iter, 0);

But in Scheme it would be silly to write:

(let ([iter (make-GtkTreeIter .... however many fields ....)])
  (gtk_list_store_insert store iter 0)
  iter)

Plus I don't think the scheme 'iter' would be modified -- don't C
return values (including output pointers) always get wrapped into new
Scheme objects by the ffi library?

> It'll be great if you get time to finish your GTK2 bindings.  And a
> great stress-test for the new FFI stuff.

I worked at it on a by-need basis.  So maybe I should make more GUIs...

Daniel


Posted on the users mailing list.