[cffi-devel] CFFI-GROVEL ASDF integration

Robert Goldman rpgoldman at sift.info
Mon Nov 5 23:04:04 UTC 2012


On 11/5/12 Nov 5 -4:37 PM, Luís Oliveira wrote:
> 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)))
> 

Let me see if I understand this: you have a grovel file, and you have
defined it as producing a .o file and a .fasl file, correct?

Now the groveling produces a lisp file from the grovel file?

If that's the case, what about defining a new operation, ASDF:GROVEL-OP,
that takes a fasl file and performs PROCESS-GROVEL-FILE on it?  I.e.,
when you PERFORM a GROVEL-OP, you get a new lisp file?  I.e., there
would be a lisp-file as the sole OUTPUT-FILE of the grovel-op.

Then you could use the standard ASDF machinery to compile the LISP file
afterwards, instead of having to do that mess with the
ASDF::ABSOLUTE-PATHNAME, etc.

For whatever file this is, you would have the following dependency:

GROVEL-FILE --GROVEL-OP--> CL-SOURCE-FILE --COMPILE-OP--> COMPILED-FILE

I'm afraid I don't understand exactly what CFFI-GROVEL is supposed to
do, so I may be getting this all wrong.

best,
r






More information about the cffi-devel mailing list