axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: Cannot Rename The File Erlib To NRLIB


From: Camm Maguire
Subject: [Axiom-developer] Re: Cannot Rename The File Erlib To NRLIB
Date: 07 Sep 2006 17:16:10 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

"Page, Bill" <address@hidden> writes:

> Camm, 
> 
> On Wednesday, September 06, 2006 1:50 PM you wrote:
> > 
> > Bill Page writes:
> > ... 
> > > > 
> > > > In src/interp/nlib.lisp.pamphlet:
> > > >
> > > > ----------
> > > > 
> > > >  ;; ($ERASE filearg) -> 0 if succeeds else 1
> > > >  (defun $erase (&rest filearg)
> > > >    (setq filearg (make-full-namestring filearg))
> > > > -  (if (probe-file filearg)
> > > > +  (if (directory (truename filearg))
> > > >  #+:CCL (delete-file filearg)
> > > >  #+:AKCL
> > > >        (if (library-file filearg)
> > > >            (delete-directory filearg)
> > > >            (delete-file filearg))
> > > >        1))
> > > > 
> > > > ----------
> > > > 
> > > ... 
> > > However I remain a little uncertain if 'directory' is really
> > > the proper way to check for the existence of a file or
> > > directory in common lisp?
> > > 
> > 
> > 1) I think you want (null (pathname-name (truename filearg)))
> >
> > 2) or (and (directory filearg) (not (probe-file filearg)))
> > 
> 
> Sorry, I still feel a little "dense" about this. Could you take
> a minute to translate these two expressions for me? I want
> 
>  (if (... filearg)
>    )
> 
> to be true if filearg is either a file *or* a directory.

My apologies -- I thought you just wanted a directory.  So both of the
above are wrong.

truename is required to return an error if the path does not exist.
So you might not want this.  

I think we might still be deviating from the spec on directory a bit.
Even though we pass all the ansi tests.  At the moment, the best I can
think of is

(or (probe-file filearg) (= 1 (length (directory filearg))))

We can change this if it is deemed insufficient, and/or add a si::stat
function. 

The pathnames returned by truename or directory, etc., are structures
with components:

device
directory
name
type

The second is a list of components, which can include keywords
:current, :absolute, etc.  It can also be nil, which gives the
default, i.e. current working dir.  Pathnames corresponding to
directories have nil in the last two slots, and have corresponding
namestrings ending in "/".  Unfortunately, as you state, directory at
present has a certain globbin/pattern matching behavior which is not
so useful in this context.  Again, we can likely change this if
needed.

Take care,


> 
> I suspect that 2) requires that it be a directory and not a file
> since 'probe-file' is now interpreted as specifically as testing
> for a *file*. So maybe that one is not right?
> 
> I am also worried about the "wild-card" properties of 'directory'
> which is not something I really want.
> 
> But I don't know the semantics of 1) at all, and having
> consulted the lisp docs as deeply as possible, I am still
> not sure. What exactly does expression 1) do on GCL?
> 



> Regards,
> Bill Page.
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]