[cffi-devel] Re: newtypes question
Luis Oliveira
luismbo at gmail.com
Tue Jun 5 21:47:38 UTC 2007
"Attila Lendvai" <attila.lendvai at gmail.com> writes:
> (cffi:define-foreign-type ppoly-t () 'ppoly-t)
Heh, it took me a while to figure out how that even compiled. It
creates a PPOLY-T class with to slots: QUOTE and PPOLY-T. I'm not sure
how to reliable detect the old syntax. The old DEFINE-FOREIGN-TYPE is
more like the new DEFINE-PARSE-METHOD.
> previously it worked
>
> (cffi:define-foreign-type _-off-64-t () '_-quad-t)
> (cffi:define-foreign-type _-quad-t () ':long-long)
(defmacro defctype* (name base-type)
"Like DEFCTYPE but defers instantiation until parse-time."
`(define-parse-method ,name ()
(make-instance 'foreign-typedef :name ',name
:actual-type (parse-type ',base-type))))
This should work. It could have a few more features of DEFCTYPE's but
that's the basic idea. Would Verrazano need this macro added to CFFI or
can it define itself somewhere? Also, suggestions for a better name are
welcome.
HTH
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
More information about the cffi-devel
mailing list