Finding out from where the .asd was loaded and/or referencing a non-executable data file
Robert Goldman
rpgoldman at sift.info
Fri Mar 16 19:22:25 UTC 2018
On 16 Mar 2018, at 13:05, Lucien P wrote:
> On Fri, Mar 16, 2018, 11:25 Robert Dodier <robert.dodier at gmail.com>
> wrote:
>
>> Hi,
>> I am resuming my tinkering on the Maxima interface to ASDF. I have
>> bumped into a kind of minor problem for which I don't see a solution.
>>
>> Maxima can read .info files for documentation items. An index file
>> (Lisp) which is created ahead of time (not run time) tells where the
>> items are in the .info. The .asd, index, and .info are all in the
>> same
>> directory. Some code in the index file tells Maxima to read the .info
>> from the same place from which the index is loaded (via
>> *LOAD-PATHNAME*).
>>
>> That works great when the asd is loaded via LOAD-SOURCE-OP since
>> *LOAD-PATHNAME* points to the directory where the .info file is. But
>> when the asd is loaded via LOAD-OP, it doesn't work, since
>> *LOAD-PATHNAME* points into the place that ASDF puts fasls.
>>
>> I gather from the ASDF reference manual that there isn't any way to
>> load, without compiling, only the index file (I'm looking at "How do
>> I
>> mark a source file to be loaded only and not compiled?"). So I'm
>> thinking about some other way to locate the .info file. Is there a
>> special variable or something which tells the path from which the
>> .asd
>> is being loaded? I looked at the documentation and the list of
>> external symbols but couldn't puzzle out anything.
>>
>> The more general idea is that the system contains a non-Lisp data
>> file. Is there a general approach to work with that?
>>
>> Thanks for any light you can shed on this problem.
>>
>> Robert Dodier
>>
>
> The way I've been doing this is with a :STATIC-FILE component (you
> must
> include file extensions).
>
> ASDF will put your static file into the FASL location without touching
> it
> then you can find it to load using ASDF:FIND-COMPONENT. One of the
> component's slots will have the pathname of the "compiled" file in it,
> you
> don't have to use *LOAD-TRUENAME*.
>
>>
I don't believe a static file should be moved, and if not moved, you
should be able to load it with something like this;
```
(asdf:system-relative-pathname "maxima" "subdir/my-static-file.blort")
```
To be honest, I don't fully understand the question. How is the index
file created, and by what process? Is it created as side-effect of
compilation, or is there some special compilation process that creates
it? If the latter, then that process could be brought under ASDF
control, and the code used to create the index file could be configured,
through the use of output-files configuration, to place the file
wherever you want.
On the other hand, if the info files are static, and the indices are
created in the FASL location, then you can just use
`ASDF:SYSTEM-RELATIVE-PATHNAME` instead of `*load-pathname*` to find the
file.
On the other other hand, you could use `*compile-file-truename*` instead
of `*load-pathname*`, but that would have semantics that could vary
(e.g., if you load some of this stuff interactively, instead of through
ASDF), so that's not an ideal choice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20180316/ebba44aa/attachment-0001.html>
More information about the asdf-devel
mailing list