[cffi-devel] user list?

Keith Irwin keith.irwin at gmail.com
Thu Jan 5 08:22:47 UTC 2006


Folks--

Is there likely to be a user list for cffi in the near future?  If
not, is it okay to ask user oriented questions (or provide dumb-user
feedback)?

For instance, I was trying to defcstruct the GdkEventKey structure for
SBCL, and couldn't use stuff like :uint32 and so on as shown in the
manual.  So I had to spend a lot of time guessing (and staring at
cffi-sbcl.lisp).  So, it seems I have to use :char for :gint8 and so
on.

The following finally allowed me to extract the keypress (for
cl-browser) I was looking for, but, alas, it wasn't so plain given the
C documentation for the actual struct (as follows).

;; CL/CFFI version

(defcstruct gdk-event-key
  "GdkEventKey"
  (gdk-event-type :int)
  (gdk-window :pointer)
  (send-event :char) ;; int8
  (time :unsigned-int)
  (state :unsigned-int)
  (keyval :unsigned-int)
  (length :int)
  (text :string)
  (hardware-keycode :unsigned-short)
  (group :unsigned-char))

;; C version

typedef struct {
  GdkEventType type;
  GdkWindow *window;
  gint8 send_event;
  guint32 time;
  guint state;
  guint keyval;
  gint length;
  gchar *string;
  guint16 hardware_keycode;
  guint8 group;
} GdkEventKey;

What confuses me a bit is the C docs. What's the diff between guint
and guint32?  Since I'm on a 32bit machine, they're the same, right?

Anyway, I figure I'm you're target luser.  Never programmed
significantly in C and am really liking how simple CFFI seems (after
sb-alien).

Are you planning on mapping more names to the SBCL part of all this? 
Having something like :unsigned-int32 as well as :unsigned-int would
allow me to remain as ignorant as I want to. ;)  (Translation: since I
deal with word size so rarely, I always have to think hard about it
and remember stuff, and that, well, interrupts the flow, you know?)

Okay, well, the work you're doing is fantastic.  It's a lot of fun.  I
might even make cl-browser the minimalist working browser out there,
if only to force myself to learn more of the huge GTK api.

Keith



More information about the cffi-devel mailing list