uffi (* :char) => corman (:char *) how to?
Kenny Tilton <[email protected]> Mon, 24 Feb 2003 06:10:15 -0500
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <[email protected]> |
I need to take:
(uffi:def-foreign-type LPSTR (* :char))
..and produce a corman:
(c-types:defctype LPSTR (:char *))
Simple. But looking at:
> (uffi:def-foreign-type UFLPSTR (* :char))
> (defun %convert-from-uffi-type (type context)
> "Converts from a uffi type to an implementation specific type"
> (if (atom type)
[snip atom handling to get to list handling...]
> (let ((sub-type (car type)))
> (print `(sub type is ,sub-type))
> (case sub-type
> (cl:quote
> (convert-from-uffi-type (cadr type) context))
> (:struct-pointer
> #+mcl `(:* (:struct ,(%convert-from-uffi-type (cadr type) :struct)))
> #-mcl (%convert-from-uffi-type (list '* (cadr type)) :struct)
> )
> (:struct
> #+mcl `(:struct ,(%convert-from-uffi-type (cadr type) :struct))
> #-mcl (%convert-from-uffi-type (cadr type) :struct)
> )
> (t
> (cons (%convert-from-uffi-type (first type) context)
> (%convert-from-uffi-type (rest type) context)))))))
...I am puzzled by a few things. Based on def-foreign-type syntax, when
do we do anything other than reach the default case with anything other
than (* <whatever>)? I know this smae function gets called in other
contexts, but a quick look thru those did not enlighten.
If my guess is right, I could just modify the last clause to read:
(t (funcall #+corman #'nreverse #-corman #'identity
(cons (%convert-from-uffi-type (first type) context)
(%convert-from-uffi-type (rest type) context))
...but that feels icky.
Or I could add a case for *:
(* (funcall #+corman #'nreverse #-corman #'identity
(cons '* (%convert-from-uffi-type (second type) context))))
uh, come to think of it I am not sure this is a "user" question, so
apologies if I hit the wrong mail list.
--
kenny tilton
clinisys, inc
http://www.tilton-technology.com/
---------------------------------------------------------------
"Cells let us walk, talk, think, make love and realize
the bath water is cold." -- Lorraine Lee Cudmore