From: Friedrich Dominicus
Subject: Fun? with pathnames
Date: 
Message-ID: <87y8fy3c4z.fsf@fbigm.here>
I can not remember that this was discussed before. Well in principle
the things with pathnames should not be a problem. However as soon as
I try to write portable code with pathname I'm loosing. Here's an
example

Take this:
(setf (logical-pathname-translations "test-pn")
               '(("**;*.*.*" "/var/tmp/**/*.*")))


with this abbreviation 
(setf (symbol-function 'tlp) #'translate-logical-pathname)

I got this in
- sbcl (tlp "test-pn:test;")
#P"/var/tmp/test/"
- clisp
  (tlp "test-pn:test;")
#P"/var/tmp/test/"
- Lispworks  
(tlp "test-pn:test;")
#P"/var/tmp/test/"
- Allegro
  (tlp "test-pn:test;")
#P"/var/tmp/test/"

So that seems to be quite ok. Now let's try
(truename "test-pn:test;")
- sbcl #P"/var/tmp/test/"
- clisp (truename "test-pn:test;")

** - Continuable Error
TRUENAME: Datei #P"/home/frido/bilder/test-pn:test;" existiert nicht.
Wenn Sie (mit Continue) fortfahren: Neuer Anlauf
Weitere m�gliche Optionen:
STORE-VALUE    :R1      Sie d�rfen einen neuen Wert f�r (FDEFINITION 'LOGICAL-PATHNAME-P) eingeben.
USE-VALUE      :R2      Sie d�rfen einen Ersatzwertf�r (FDEFINITION
'LOGICAL-PATHNAME-P) eingeben.
???

LispWorks
#P"/var/tmp/test/"

Allegro
#P"/var/tmp/test/"

So at least SBCL, LispWorks and Allegro agree about, but Clisp not. I


Is this a bug in ether Clisp or the other three Lisp
or what else is wrong?

Regards
Friedrich

-- 
Please remove just-for-news- to reply via e-mail.

From: Martin Ginkel
Subject: Re: Fun? with pathnames
Date: 
Message-ID: <cprocl$163r$1@gwdu112.gwdg.de>
Friedrich Dominicus wrote:
> (truename "test-pn:test;")
> - sbcl #P"/var/tmp/test/"
> - clisp (truename "test-pn:test;")
> 
> ** - Continuable Error
> TRUENAME: Datei #P"/home/frido/bilder/test-pn:test;" existiert nicht.
> Wenn Sie (mit Continue) fortfahren: Neuer Anlauf
> Weitere mögliche Optionen:
> STORE-VALUE    :R1      Sie dürfen einen neuen Wert für (FDEFINITION 'LOGICAL-PATHNAME-P) eingeben.
> USE-VALUE      :R2      Sie dürfen einen Ersatzwertfür (FDEFINITION
> 'LOGICAL-PATHNAME-P) eingeben.

Clisp is different:
it only recognizes logical-pathnames if you explicitly create them
with (logical-pathname "bla:blu;blup.blurp").
Otherwise it interprets it as a normal system-pathname, because of
compatibility with Windooze drive-paths. (C:\gurk)

I thought about creating a dispatcher-macro for this
#l"bla:blu;blupp.blurp"

	HTH
	Martin





-- 
+-[Martin Ginkel]-------------[mailto:mginkel(at)mpi-magdeburg.mpg.de]-+
| MPI Magdeburg, Zi S2.09    Sandtorstr. 1, D-39106 Magdeburg, Germany |
| It could be that the purpose of life is serving as warning to others |
|                                                                      |
+-[tel/fax: +49 391 6110 482/529]----[http://www.mpi-magdeburg.mpg.de]-+
From: Pascal Bourguignon
Subject: Re: Fun? with pathnames
Date: 
Message-ID: <87pt1a4jfj.fsf@thalassa.informatimago.com>
Friedrich Dominicus <···················@q-software-solutions.de> writes:

> I can not remember that this was discussed before. Well in principle
> the things with pathnames should not be a problem. However as soon as
> I try to write portable code with pathname I'm loosing. Here's an
> example
> 
> Take this:
> (setf (logical-pathname-translations "test-pn")
>                '(("**;*.*.*" "/var/tmp/**/*.*")))
 
I think you have to keep the same number of wildcards in both paths.


[3]> (SETF (LOGICAL-PATHNAME-TRANSLATIONS "TEST-PN")
           (LIST
            (LIST "**;*"     "/var/tmp/**/*")
            (LIST "**;*.*"   "/var/tmp/**/*.*")
            (LIST "**;*.*.*" "/var/tmp/**/*.*.*")))
((#P"TEST-PN:**;*" "/var/tmp/**/*") (#P"TEST-PN:**;*.*" "/var/tmp/**/*.*")
 (#P"TEST-PN:**;*.*.*" "/var/tmp/**/*.*.*"))
[4]> (translate-logical-pathname "test-pn:test;")

#P"/var/tmp/test/"
[5]> (translate-logical-pathname "test-pn:test;toto")
#P"/var/tmp/test/toto"
[6]> (translate-logical-pathname "test-pn:test;toto.titi")
#P"/var/tmp/test/toto.titi"
[7]> (translate-logical-pathname "test-pn:test;toto.titi.32")
#P"/var/tmp/test/toto.titi"
[8]> 

On some implementations like SBCL you'll have to change the order of
the translations:

#+SBCL
(setf (logical-pathname-translations "TEST-PN")
      (sort (copy-seq (logical-pathname-translations "TEST-PN"))
            (lambda (a b) (< (length (pstring (second a)))
                        (length (pstring (second b)))))))


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Cats meow out of angst
"Thumbs! If only we had thumbs!
We could break so much!"