Sean <[EMAIL PROTECTED]> writes:
> I've been specialising translate-to-foreign to automatically convert c
> structures to their equivalent lisp counterparts but without these lines
> this obviously no longer works.
>
> Was this removal deliberate and if so what is the preferred way to
> accomplish this?

Hmm.  I tried to track this alleged removal, unsuccessfully. :-) Are you
sure you didn't add that code yourself?  I can't find this code in
either 0.9.0 or 0.9.1.

In any case, you bring up a good point, which I've mentioned before too:
  <http://article.gmane.org/gmane.lisp.cffi.devel/1033>

Using the cffi-newtypes branch (which I hope to merge soon, since there
haven't been any complaints, unless James has any objections), you could
do something like this:

  (defcstruct %my-struct ...)

  (define-foreign-type my-struct-type ()
    ()
    (:actual-type %my-struct)
    (:simple-parser my-struct))

  (defmethod translate-from-foreign (value (type my-struct-type)) ...)
  (defmethod translate-to-foreign (value (type my-struct-type)) ...)
  (defmethod free-translated-object (value (type my-struct-type) param) ...)

Now, perhaps defcstruct could take an option to define a type class thus
avoiding the need to define a wrapper type.  Perhaps something like
this?

  (defcstruct (my-struct :class my-struct-type)
    ...)

Any comments?

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/

_______________________________________________
cffi-devel mailing list
[EMAIL PROTECTED]
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to