[cffi-devel] lispname/cname ordering
James Bielman
jamesjb at jamesjb.com
Tue Jan 3 10:25:26 UTC 2006
On Mon, 2006-01-02 at 23:59 -0800, Matthew Backes wrote:
> CFFI tends to have name specifications like (c-name lisp-name)
> whenever fully specifying the names as a list.
>
> In CFFI-Grovel, we're tentatively doing (lisp-name &rest c-names) in
> several places (for constants and enums). This is so that we can
> easily provide a list of alternative c-names for the groveler to try
> as it hunts for the symbol. e.g.:
>
> (defconstant (path-max "PATH_MAX" "MAXPATHLEN"))
>
> which covers both SYSVish and BSDish systems.
>
> But this is bad because it's backwards from what CFFI does. Anyone
> have any ideas on a good syntax? I'd really like groveler forms to
> strongly resemble CFFI (or CL) forms to reduce user confusion.
Personally, I find it confusing to use the same name as a CL or CFFI
operator with a different syntax and semantics. If I understand how
CFFI-GROVEL works, the forms in the constants file are data, not code,
so it doesn't seem appropriate to try to make them look like code.
What about a syntax like:
(type "size_t" :size :unsigned)
(constant ("PATH_MAX" "MAXPATHLEN") path-max)
;; This struct syntax probably needs some work...
(struct "pollfd" pollfd
(("fd" fd)
("events" events)
("revents" revents))
(:documentation "Poll file descriptor structure."))
(variable "errno" errno :int)
with the general form being:
(OBJECT C-NAME-STRING-OR-LIST LISP-NAME &rest options)
(I assume this is grossly incompatible with SB-GROVEL, which I haven't
really used. Obviously if you are trying to stay close to SB-GROVEL,
this might not be a good idea...)
James
More information about the cffi-devel
mailing list