[Top][All Lists]

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

[Gcl-devel] Re: directory/truename transition

From: Camm Maguire
Subject: [Gcl-devel] Re: directory/truename transition
Date: 03 Jul 2007 23:25:17 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4


Waldek Hebisch <address@hidden> writes:

> > Greetings!
> > 
> > I am prepared to backport the clisp-style directory/truename behavior,
> > but this breaks current axiom, and I do not want to leave the project
> > even temporarily without a gcl to build it.  Please advise.  
> > 
> > 2.7.0 (with the commits to go in shortly) appears to build wh-sandbox
> >     save for this issue.
> > 
> wh-sandbox builds using clisp.  We need 21 clisp specific conditionals.
> 9 of those conditionals is due to file and directory handling.  In some
> cases current code uses gcl specific method that will work regardless of
> the change, but in some cases gcl specific section will need update. So
> one can estimate that change in gcl will require about between 10 to 60
> lines of extra code (extra conditionals + code to handle extra case).
> I belive that truename change affects only one place in wh-sandbox,
> namely the 'axiom-probe-file' function in 'src/lisp/axiom-lisp.lisp.pamphlet'.
> clisp variant needs 4 lines of code + 1 line for conditional, but
> since different gcl versions work differently, gcl will probably
> need 6-8 lines of extra code here.
> Directory change also is problematic: in 'src/interp/daase.lisp.pamphlet'
> in the function 'localdatabase' we need list of files matching
> '*.NRLIB/index.KAF'.  With all other Lisps we just use this pattern.
> But gcl on Windows cannot handle it.  So we use '*.NRLIB' and
> append '/index.KAF' using string concatenation.  We will have to
> change this to '*.NRLIB/' for the new version (which is trivial)
> and add proper conditional.  How complex test is need will depend
> on gcl -- in the worst case we will have to run a test program
> from configure and propagate results to the Lisp, which will
> take probably about 20 lines of code. 
> Important thing is that clisp file handling can loose some functionality
> -- currently I do not know how to rename directory using clisp
> (apparently clisp 'rename-file' does not work on directories).
> Similarly, I do not not how to delete empty directory using clisp.

This is all quite depressing.  It appears the clspec is quite
deficient in this regard.  Hence, I think the proper goal for GCL is
to be as close to posix and "intuition" in this regard while still
passing the spec.  

The whole goal was 1) to support pathnames with spaces, ala mingw, and
2) to provide some natural means within the spec for distinguishing a
directory from a file.  clisp seems appropriate for this, but does not
allow one to overlay delete-file et. al. for directories.  This does
seem a good tradeoff on reflection, as any general overlay is going to
run afoul of all sorts of problems trying to #'open a directory and
#'read therefrom.  If this perspective is the right one, all the spec
functions but #'directory should work only on files, and GCL should
provide functions in 'si to do the directory manipulations outside the

As they are outside the spec, is there any reason not to implement
these where possible with #'system?  The bourne shell is likely at
least as portable as GCL is.  I was worried about the following
directory implementation:

        sprintf(command, "shopt -s dotglob; "
                         "IFS='' j=\"%s\"; for i in $j ; do ! [ -e \"$i\" ] || 
%c [ -d \"$i\" ] || echo \"$i\" ; done", filename, ch);

but I think it likely that this will even work on mingw.

> Another question is how to detect which version of functions is
> present -- the old one or the new one.  Note that for testing we
> want Axiom sources to work with different gcl versions, so we
> need automatic way to choose correct variant.
> I would suggest that gcl _first_ adds nonstandard functions that
> implement Posix style file handling and only later changes Ansi Lisp
> functions to clisp semantic.  That way users that want Posix
> semantics can use Posix functions if presesnt and otherwise be assured
> that they get old gcl semantics (which is closer to Posix than the
> clisp way) from standard Lisp functions.
> Some functions were added to gcl, but I am affraid that some
> functions that Axiom needs are still missing.  Let me try to
> enumerate functions that Axiom uses:
> change directory
> make directory (done via C)
> get current directory name
> get absolute name of a directory
> delete file or directory
> rename file or directory
> find all files matching pattern "*.NRLIB/index.KAF"
> recursively copy directory with content (currently invokes the 'cp' program)
> copy file (likewise)

Thanks for this list.  Will get these in.

Take care,

> -- 
>                               Waldek Hebisch
> address@hidden 

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]