guile-user
[Top][All Lists]
Advanced

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

gnome-guile and C types?


From: Bill Gribble
Subject: gnome-guile and C types?
Date: 15 Oct 2001 12:46:08 -0500

I'd like to write some custom wrappers for various gnome functions that
don't have bindings in libguilegnome.  How are the C types mapped onto
Scheme types, and is there an available API to convert them?  

For example, let's say I have a C function that returns a GList of
GtkWidget *.  I know that gnome-guile doesn't deal with GLists, so I
want to write a C function that explicitly handles the wrapping for this
case.  In the following example, how would I write convert_c_ptr() so
that a gnome-guile program written in Scheme could use the returned
value as expected?

SCM
handwritten_foo_glue(void) 
{
  GList * l = gtk_foo_func();
  GList * p;
  SCM ret = SCM_EOL;
   
  for(p=l; p; p=p->next) 
  {
    ret = scm_cons(convert_c_ptr(GTK_WIDGET(p->data)), ret);
  }
  g_list_free(l);

  return scm_reverse_x(ret, SCM_EOL);
} 
   
Thanks,
b.g.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]