[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
file loading query
I have a problem with the way Common Lisp says pathname defaults should be
handled during load. I have a software system structured as a header file
FOO.LISP that loads various component files BAR1, BAR2, BAR3, etc. Some of
the component files may in turn load other components.
Now, I actually have several versions of this system, each living in its
own directory. Whenever I make a new version due to an experimental change
to one component, or to test out the code generated by a new compiler, I
put it in its own directory. The problem is, how do I get the calls to
LOAD that appear in FOO, and in the files loaded by FOO, to look in
whatever directory the header file FOO was loaded from?
The current definition of LOAD looks at *DEFAULT-PATHNAME-DEFAULTS*, so one
solution would be to set this variable manually every time, before loading
FOO. That's a real nuisance, which I'd like to avoid if possible. Another
possibility would be to add a line at the beginning of FOO to set
*DEFAULT-PATHNAME-DEFAULTS*, but that also loses because (a) every time I
made a new copy of the software I would have to edit FOO, and (b) when I
want to replace one version of the software with another, as when replacing
the contents of directory old/ with current/ and current/ with new/, I
would have to make sure NOT to copy the header file. The potential for
problems if the header file is accidentally copied is too great.
In some implementations (either the Symbolics or the TI machine I worked on
about 2 years ago), a call to LOAD embedded in a file appeared to get its
pathname defaults from the pathname of the parent file being loaded, but
this doesn't appear to be part of the Common Lisp standard. In other
implementations I seem to recall LOAD rebinding *STANDARD-INPUT*, so I
could snarf the actual pathname information from there. But in CMU Common
Lisp, LOAD does not rebind *STANDARD-INPUT*, and CLtL doesn't seem to
require this. So...
1. Anybody know a *portable* trick I can use to get embedded calls to LOAD
to use the parent file's pathname as a default?
2. How terrible would it be for LOAD to rebind *DEFAULT-PATHNAME-DEFAULTS* ?
3. Alternatively, what would people think of adding a :PARENT-PATH keyword
to LOAD. With a value of T this keyword would mean "if this is an embedded
load, get default pathname information from the pathname of the parent