[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] pathnames
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] pathnames |
Date: |
27 Feb 2004 19:00:56 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings, and thanks for this! OK, this is a straightforward change
in keyword names from what we have now. I'll put this on the list for
early 2.7.x. Please don't let me forget.
Take care,
Dennis Decker Jensen <address@hidden> writes:
> Hi Camm
>
> Sorry for putting up new thread, but I deleted your mail by
> mistake.
>
> I've been playing with pathnames in CLisp and SBCL to find out
> more from other actual implementations, and there are notable
> differences in how it can be done.
>
> I will not go into too much details. The most significant
> difference to GCL's old (CLTL2?) implementation is in the
> pathname-directory component of a pathname.
>
> In ANSI the directory component (a list) must start with either
> the symbol RELATIVE or the symbol ABSOLUTE. From there only
> strings and the symbols UP or BACK are allowed. The difference
> between the latter and the former is a matter of syntactic or
> semantic behaviour.
>
> How the namestrings are constructed depends upon the
> implementation. SBCL don't accept BACK at the moment when
> constructing namestrings, while CLisp has both UP and BACK
> taking semantic behaviour. SBCL does't touch it's pathnames,
> while CLisp does at creation time as you can see below in the
> examples.
>
> GCL currently uses symbols as well as strings with the special
> symbols ROOT, CURRENT and PARENT which has special meanings.
> I gather this is the CLTL2 way. None of this is ANSI anyway.
>
> There are further constraints on some of the other components,
> but I don't think it is all needed at once judged by the other
> implementations and the diversity among them.
>
> Examples:
>
> <<<CLisp>>>
>
> ;; Dribble of #<IO TERMINAL-STREAM> started 2004-02-27 14:07:39
> #<OUTPUT BUFFERED FILE-STREAM CHARACTER #P"clisp.pathnames">
> [2]> (make-pathname :directory '(:relative "a" "b" "c"))
> #P"a/b/c/"
> [3]> (make-pathname :directory '(:absolute "a" "b" "c"))
> #P"/a/b/c/"
> [4]> (make-pathname :directory '(:absolute "a" "b" :up "c"))
> #P"/a/c/"
> [5]> (make-pathname :directory '(:absolute "a" "b" :back "c"))
> #P"/a/c/"
> [6]> (pathname-directory (make-pathname :directory '(:absolute "a" "b" :back
> "c")))
> (:ABSOLUTE "a" "c")
> [7]> (pathname-directory #P"/a/b/../c/")
> (:ABSOLUTE "a" "c")
> [8]> (pathname-directory #P"/a/b/c/")
> (:ABSOLUTE "a" "b" "c")
> [9]> (pathname-directory #P"/a/b/c")
> (:ABSOLUTE "a" "b")
> [10]> (dribble)
> ;; Dribble of #<IO TERMINAL-STREAM> finished 2004-02-27 14:10:07
>
> ;; Dribble of #<IO TERMINAL-STREAM> started 2004-02-27 14:28:08
> #<OUTPUT BUFFERED FILE-STREAM CHARACTER #P"clisp.pathnames">
> [2]> (make-pathname :directory '("a" "b" "c"))
>
> *** - MAKE-PATHNAME: illegal :DIRECTORY argument ("a" "b" "c")
> Break 1 [3]> :q
>
> [4]> (make-pathname :directory '(:relative "a" "b" "c"))
> #P"a/b/c/"
> [5]> (make-pathname :directory '(:relative "a" "b" :parent "c"))
>
> *** - MAKE-PATHNAME: illegal :DIRECTORY argument (:RELATIVE "a" "b" :PARENT
> "c")
> Break 1 [6]> :q
>
> [7]> (make-pathname :directory '(:relative "a" "b" :current "c"))
>
> *** - MAKE-PATHNAME: illegal :DIRECTORY argument (:RELATIVE "a" "b" :CURRENT
> "c")
> Break 1 [8]> :q
>
> [9]> (dribble)
> ;; Dribble of #<IO TERMINAL-STREAM> finished 2004-02-27 14:29:01
>
>
> <<<SBCL>>>
> * (make-pathname :directory '(:relative "a" "b" "c"))
>
> #P"a/b/c/"
> * (make-pathname :directory '(:absolute "a" "b" "c"))
>
> #P"/a/b/c/"
> * (make-pathname :directory '(:absolute "a" "b" :up "c"))
>
> #P"/a/b/../c/"
> * (make-pathname :directory '(:absolute "a" "b" :back "c"))
>
> #<PATHNAME
> (with no namestring)
> :HOST #<SB-IMPL::UNIX-HOST {505D1B9}>
> :DEVICE NIL
> :DIRECTORY (:ABSOLUTE "a" "b" :BACK "c")
> :NAME NIL
> :TYPE NIL
> :VERSION NIL>
> * (pathname-directory (make-pathname :directory '(:absolute "a" "b" :up "c")))
>
> (:ABSOLUTE "a" "b" :UP "c")
> * (pathname-directory #P"/a/b/../c/")
>
> (:ABSOLUTE "a" "b" :UP "c")
> * (pathname-directory #P"/a/b/c/")
>
> (:ABSOLUTE "a" "b" "c")
> * (pathname-directory #P"/a/b/c")
>
> (:ABSOLUTE "a" "b")
> * (pathname-directory #P"a/b/c/")
>
> (:RELATIVE "a" "b" "c")
> * (pathname-directory #P"../../")
>
> (:RELATIVE :UP :UP)
> * (pathname-directory (parse-namestring "/a/b/../c/"))
>
> (:ABSOLUTE "a" "b" :UP "c")
>
> * (make-pathname :directory '("a" "b" "c"))
>
> #<PATHNAME
> (with no namestring)
> :HOST #<SB-IMPL::UNIX-HOST {505D1B9}>
> :DEVICE NIL
> :DIRECTORY ("a" "b" "c")
> :NAME NIL
> :TYPE NIL
> :VERSION NIL>
> * (make-pathname :directory '(:relative "a" "b" "c"))
>
> #P"a/b/c/"
> * (make-pathname :directory '(:relative "a" "b" :parent "c"))
>
> debugger invoked on a SIMPLE-ERROR in thread 31541:
> :PARENT is not allowed as a directory component.
>
> * (make-pathname :directory '(:relative "a" "b" :current "c"))
>
> debugger invoked on a SIMPLE-ERROR in thread 31541:
> :CURRENT is not allowed as a directory component.
>
> >>>
>
> I haven't looked at logical pathnames which is whole topic
> itself.
>
> Hope it made things a little clearer.
>
> --
> Dennis Decker Jensen
>
>
>
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah