Subject: [clisp-list] using logical-pathnames in CLISP

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Wed Dec 11 09:01:07 2002

Hi,

despite years of Common Lisp, all I know about logical pathnames since IIRC Marcus Daniels started adding some code in 1994 is that they would come in my way, since on the Amiga, there are typically 10-60 valid pathnames like "clisp:src/lispbibl.d" and "devs:Monitors/A2024.monitor". I also knew that MS-DOS/MS-Windows users would have similar problems with them, because they have C:\autoexec.bat, PRN: etc. which must be passed to the OS.

I also know CMUCL's search lists, which I found very useful. Little overhead, easy to use. They looked like AmigaOS' pathnames. The effect is somewhat similar to what file-system people call union (or overlay) file systems.

Can logical-pathnames nevertheless be used in CLISP with MS-Windows?

How do people use them, on any OS? (UNIX/Linux/xy)
What do other implementations do on MS-Windows?

impnotes says:
>The ANSI-mandated behavior of recognizing logical pathnames when the
>string begins with some alphanumeric characters followed by a colon (#\:)
>is very confusing (cf. "c:/autoexec.bat", "home:.clisprc" and "prep:/pub/gnu")
>and therefore disabled by default. To enable the ANSI standard behavior, you
>should set CUSTOM:*PARSE-NAMESTRING-ANSI* to non-NIL.

What are the effects of this switch w.r.t. logical-pathnames? Is it a real win, because every function like LOAD, OPEN etc. suddenly accepts pathnames like "clispsrc:modules;bindings;linux.lisp") instead of very deep full pathnames?

Can I somehow say, with CLISP
(probe-file "clispsrc:src/foreign.d") like I can with native OS pathnames on the Amiga and also with cmucl - #+cmucl(ext:unix-naemstring x)?
and still have (probe-file "c:\\Progra~1\\foo.txt") work?

Observe that
> (logical-pathname "c:/foo/doc/i.html")
#S(LOGICAL-PATHNAME :HOST "C" :DEVICE NIL :DIRECTORY (:RELATIVE "FOO" "DOC")
   :NAME "I" :TYPE "HTML" :VERSION NIL)
> (logical-pathname "c:foo/doc/i.html")
#S(LOGICAL-PATHNAME :HOST "C" :DEVICE NIL :DIRECTORY (:ABSOLUTE "FOO" "DOC")
   :NAME "I" :TYPE "HTML" :VERSION NIL)
is just the other way round from parse-namestring for MS-DOS/Windows
C:/foo -> :absolute, C:foo -> :relative

Thanks for enlightening me,
	Jörg Höhle.

---

From: Sam Steingold <[email-masked]>
Date: Wed Dec 11 10:17:06 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] using logical-pathnames in CLISP"
> * Sent on Wed, 11 Dec 2002 18:00:07 +0100
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>

It depends.

First, note that logical pathnames do not mix well with non-logical
ones on woe32 (because of the "C:\" abomination you mentioned).

Second, logical pathnames cannot work with "bad" filenames (containing
spaces, commas &c).

So, if you are only using "good" filenames, you can enable this.

You will need to create a bunch of logical hosts first.
I suggest having a file `loghosts' in your *load-path* which will
define the following hosts:
1. "home" (where your files are, something like "c:\programs and
    settings\foo\bar\baz\whatever bill made it to be\")
2. "top" ("c:\")

see <impnotes.html#load-lpt>

> Can I somehow say, with CLISP (probe-file "clispsrc:src/foreign.d")
> like I can with native OS pathnames on the Amiga and also with cmucl -
> #+cmucl(ext:unix-naemstring x)?  and still have (probe-file
> "c:\\Progra~1\\foo.txt") work?

obviously not.

> C:/foo -> :absolute, C:foo -> :relative

believe it or not, this is what the standard requires.

note that the correct separator is ";", not "/" or "\".
clisp supports the slashes only as a `courtesy'.

I hope others will chime in...

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
You think Oedipus had a problem -- Adam was Eve's mother.

---

From: Russell McManus <[email-masked]>
Date: Wed Dec 11 12:25:22 2002

> So, if you are only using "good" filenames, you can enable this.

I have found that logical pathnames are most useful when writing tools
for system construction, not interacting with the outside world, for
the reasons that Sam mentions.  

If you name your own source files such that they fit without lossage
into a logical pathname, this will at least allow you to have portable
"load" forms, defsystem's, etc. 

-russ