[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pathnames, portability, ed, eval-when, compile-file, fasl files
First question:
Is there any *portable* way to get the pathname of the file
that is currently being compiled or loaded? I would like to
be able to edit the file when an error occurs (similar to
turbo pascal).
That is, if someone types:
(compile-file ">daly>foo.lisp")
and my parser detects an error, I'd like to
(ed ">daly>foo.lisp")
but there doesn't appear to be a get-current-pathname function
defined anywhere.
Does common lisp plan to add such a function when the 'debugging
facilities' get expanded?
Actually, I'd like to be able to incant
(progn (ed ">daly>foo.lisp") (ed-search arbitrary-text-string))
which would leave the user in the editor and positioned at the error.
It appears that this could be defined in a portable manner
as every editor has a text search command.
And, dreaming on, I'd like a definition of
(ed-command arbitrary-but-implementation-dependent-editor-command)
that is, I'd like the interface syntax to the editor command handler
to be defined in a portable manner. I understand that the actual
commands to perform the manipulations would be different across
systems but I could create editor scripts and assign them to
implementation dependent variables.
Second question:
Is there any *portable* way I can tell whether a macro is being
expanded in the compile time environment or the top level
command environment?
That is, I need to set up certain compile time information for
macros. These macros perform two functions. They generate
forms for the compiler to compile into the file and they
set up top level environment information. If they are expanded
from compile-file in the compile-time environment, they modify
the global state. If they are expanded at the top level they
create and return forms that modify the global state redundantly.
Truly tedious programming gets around this problem but one of two
possible modifications to common lisp would solve *my* problem.
First, export the state used by EVAL-WHEN so I can use it (eval-when
does not seem to be available except at the top level, thus I have
to hack a compiler:phase-1-hook property which is beyond my cutoff
point for hacking this week). If I could get at the state I could
conditionalize my code without using eval-when special forms.
The second modification would be to allow me to write into a fasl
file without using compile-file. That is,
(compile 'foo :output-file pathname :if-exists :append)
If I could write compiled objects I could create my own fasl file
definition and write something portable that would get around the
previous hacks.
tim.
DALY@IBM.COM
T. J. Watson Research Center
If I had ham, I could have ham and eggs, if I had eggs. Sigh.