[cffi-devel] CFFI-GROVEL ASDF integration
Luís Oliveira
luismbo at gmail.com
Mon Nov 5 22:37:31 UTC 2012
Hello Mark,
On Mon, Nov 5, 2012 at 11:57 AM, Mark Cox <markcox80 at gmail.com> wrote:
> I think there are two ways to proceed. The first is to stick with the assumption that the
> list returned by ASDF:OUTPUT-FILES only contains one item, but process that single
> item according to the current lisp machine. The second is to assume that
> ASDF:OUTPUT-FILES can return any number of items. The later is the approach my
> patch took with the introduction of %COMPILE-FILE-TO-PATHNAME. The problem
> with the later is that it is not specified how one creates the output file from the input
> source file. I am not sure if Juan reads this list. He may have a better idea on how
> to achieve this approach.
Thanks for your clear explanation. After reading it, then re-reading
your patch, I reached the following conclusions:
1. Your patch is processing the grovel file n times, where n is the
number of items ASDF:OUTPUT-FILES returns. That doesn't make
sense, since we only need to process the grovel file once to
produce a Lisp file.
2. In this case, since GROVEL-FILE inherits from
ASDF:CL-SOURCE-FILE, ASDF:OUTPUT-FILES is computing what the
result of compiling the intermediate lisp file should be. We pass
it to PROCESS-GROVEL-FILE just to figure out where we should be
placing the intermediate lisp file. (Perhaps there's a better way
to do that, I don't know.)
3. It would be nice if we didn't have to do Lisp compilation/loading
ourselves. Instead, maybe we could delegate that task to
the methods specialized on ASDF:CL-SOURCE-FILE.
What do you think about something along these lines?
(defmethod asdf:perform ((op asdf:compile-op) (c grovel-file))
(let* ((fasl-path (first (asdf:output-files op c))))
(lisp-file (process-grovel-file (asdf:component-pathname c)
fasl-path)))
(setf (slot-value c 'asdf::absolute-pathname) lisp-file)
(call-next-method)))
It'd be nice if someone with more ASDF-fu could chime in. :-)
Cheers,
--
Luís Oliveira
http://r42.eu/~luis/
More information about the cffi-devel
mailing list