Since ACL is the most ANSI compliant, it's easy to get what I need. I have
added the following to ~/.clinit.cl:
(setf (logical-pathname-translations "clocc")
'(("**;*.*.*" "/home/paolo/projects/clocc/")
(";**;*.*.*" "/home/paolo/projects/clocc/")))
Here are examples of use with a file at the root of the CLOCC distribution
and one deeper in the hierarchy:
USER(2): (translate-logical-pathname "clocc:clocc.lsp")
#p"/home/paolo/projects/clocc/clocc.lsp"
USER(11): (translate-logical-pathname "clocc:src;cllib;list.lsp")
#p"/home/paolo/projects/clocc/src/cllib/list.lsp"
The same translations added to .cmucl-init.lisp do not work with CMU CL:
* (translate-logical-pathname "clocc:clocc.lsp")
Error in function TRANSLATE-LOGICAL-PATHNAME:
No translation for #.(logical-pathname "CLOCC:CLOCC.LSP")
Restarts:
0: [ABORT] Return to Top-Level.
Debug (type H for help)
(TRANSLATE-LOGICAL-PATHNAME #.(logical-pathname "CLOCC:CLOCC.LSP"))
0]
So I have tried a set of "conservative" translations that do not use wild
inferiors:
(setf (logical-pathname-translations "clocc")
'(("*.*.*" "/home/paolo/projects/clocc/")
("*;*.*.*" "/home/paolo/projects/clocc/*/")))
The translations don't generate any errors, but they give the wrong result
for paths containing subdirectories:
* (translate-logical-pathname "clocc:clocc.lsp")
#p"/home/paolo/projects/clocc/clocc.lsp"
* (translate-logical-pathname "clocc:src;cllib;list.lsp")
#p"/home/paolo/projects/clocc/list.lsp"
I have problems also with CLISP. Here is what happens with the ACL
translations added to .clisprc:
[10]> (translate-logical-pathname "clocc:clocc.lsp")
*** - TRANSLATE-PATHNAME: replacement pieces ((:DIRECTORY) "clocc" "lsp"
NIL) do not fit into #P"/home/paolo/projects/clocc/"
1. Break [11]>
With the "conservative" translations:
(setf (logical-pathname-translations "clocc")
'(("*.*.*" "/home/paolo/projects/clocc/")
("*;*.*.*" "/home/paolo/projects/clocc/*/")))
the situation does not change for a path containing subdirectories
(LOGICAL-PATHNAME is required by CLISP because "clocc:clocc.lsp" is treated
like a simple string):
[2]> (translate-logical-pathname (logical-pathname "clocc:clocc.lsp"))
#P"/home/paolo/projects/clocc/clocc.lsp"
[8]> (translate-logical-pathname (logical-pathname
"clocc:src;cllib;list.lsp"))
*** - TRANSLATE-LOGICAL-PATHNAME: No replacement rule for
#S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL
:DIRECTORY (:ABSOLUTE "SRC" "CLLIB") :NAME "LIST" :TYPE "LSP" :VERSION
NIL
) is known.
1. Break [9]>
[10]> (translate-logical-pathname "clocc:src;cllib;list.lsp")
*** - TRANSLATE-LOGICAL-PATHNAME: No replacement rule for
#S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL
:DIRECTORY (:ABSOLUTE "SRC" "CLLIB") :NAME "LIST" :TYPE "LSP" :VERSION
NIL
) is known.
1. Break [11]>
I have checked several sources (CLHS, CLtL2, the CLISP and CMU CL
documentation and mailing list archives), but I am unable to devise
appropriate translations for CLISP and CMU CL. The main problem is that I
don't have a clear view of the CLISP and CMU CL differences with ANSI
pathname management (and I probably need to read the relevant CLHS sections
a couple more times :) Any suggestions?
Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/
> I use ACL 5.0.1, CLISP 2000-03-06 and CMU CL 18b on a Linux system. I would
> like to set a logical host and appropriate translations to access a
> directory hierarchy, for example that of the CLOCC distribution, but I have
> problems with CMU CL and CLISP.
>
> Since ACL is the most ANSI compliant, it's easy to get what I need. I have
> added the following to ~/.clinit.cl:
>
> (setf (logical-pathname-translations "clocc")
> '(("**;*.*.*" "/home/paolo/projects/clocc/")
> (";**;*.*.*" "/home/paolo/projects/clocc/")))
>
> Here are examples of use with a file at the root of the CLOCC distribution
> and one deeper in the hierarchy:
>
> USER(2): (translate-logical-pathname "clocc:clocc.lsp")
> #p"/home/paolo/projects/clocc/clocc.lsp"
>
> USER(11): (translate-logical-pathname "clocc:src;cllib;list.lsp")
> #p"/home/paolo/projects/clocc/src/cllib/list.lsp"
The following set of translations seem to work across CMUCL, ACL and
LispWorks:
* (setf (logical-pathname-translations "clocc")
'(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*")))
(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*"))
* (translate-logical-pathname "clocc:src;cllib;list.lsp")
#p"/home/paolo/projects/clocc/src/cllib/list.lsp"
* (translate-logical-pathname "clocc:clocc.lsp")
#p"/home/paolo/projects/clocc/clocc.lsp"
ACL:
USER(1): (setf (logical-pathname-translations "clocc")
'(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*")))
(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*"))
USER(2): (translate-logical-pathname "clocc:src;cllib;list.lsp")
#p"/home/paolo/projects/clocc/src/cllib/list.lsp"
USER(3): (translate-logical-pathname "clocc:clocc.lsp")
#p"/home/paolo/projects/clocc/clocc.lsp"
LWL:
CL-USER 1 > (setf (logical-pathname-translations "clocc")
'(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*")))
(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*"))
CL-USER 2 > (translate-logical-pathname "clocc:src;cllib;list.lsp")
#P"/home/paolo/projects/clocc/src/cllib/list.lsp"
CL-USER 3 > (translate-logical-pathname "clocc:clocc.lsp")
#P"/home/paolo/projects/clocc/clocc.lsp"
> I have problems also with CLISP. Here is what happens with the ACL
> translations added to .clisprc:
I don't know what CLISP's problem is, though...
Regs, Pierre.
--
Pierre Mai <pm...@acm.org> PGP and GPG keys at your nearest Keyserver
"One smaller motivation which, in part, stems from altruism is Microsoft-
bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
As for CLisp, you should check the implementation notes and be sure
that you have a recent version. Bruno and Sam fixed a few buglets wrt
LPs very recently.
Cheers
--
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa
> Since ACL is the most ANSI compliant, it's easy to get what I need. I have
> added the following to ~/.clinit.cl:
> (setf (logical-pathname-translations "clocc")
> '(("**;*.*.*" "/home/paolo/projects/clocc/")
> (";**;*.*.*" "/home/paolo/projects/clocc/")))
I don't think that translations are specified in the uniform way
you're assuming -- quite apart from anything else the translated-to
pathname syntax is implementation-dependent. I might be wrong about
that though, I always tend to just hack them till they work...
Anyway, this works on all the CLs you mention I think:
(setf (logical-pathname-translations "clocc")
'(("*.*.*" "/home/paolo/projects/clocc/") ;for foo:bar.h
("**;*.*.*" "/home/paolo/projects/clocc/**/") ;foo:bar;h.h
(";**;*.*.*" "/home/paolo/projects/clocc/**/"))) ;foo:;bar;h.h
--tim
> What's the difference between the second and third rule? "**;*.*.*"
> vs ";**;*.*.*"?
The second doesn't match on foo:;bar;henry;a.b
although this works, you should really have matching wildcards in the
translation:
(setf (logical-pathname-translations "clocc")
'(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*")))
this yields the same results as the ones you have in Allegro CL, but they
may work better in the other CLs, too.
#:Erik
> The following set of translations seem to work across CMUCL, ACL and
> LispWorks:
>
> * (setf (logical-pathname-translations "clocc")
> '(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
> (";**;*.*.*" "/home/paolo/projects/clocc/**/*.*")))
They work under ACL, but fail in the case of the file at the root of the
hierarchy:
* (translate-logical-pathname "clocc:clocc.lsp")
Error in function TRANSLATE-LOGICAL-PATHNAME:
No translation for #.(logical-pathname "CLOCC:CLOCC.LSP")
Restarts:
0: [ABORT] Return to Top-Level.
Debug (type H for help)
(TRANSLATE-LOGICAL-PATHNAME #.(logical-pathname "CLOCC:CLOCC.LSP"))
0]
* (translate-logical-pathname "clocc:src;cllib;list.lsp")
#p"/home/paolo/projects/clocc/src/cllib/list.lsp"
The problem, however, can be fixed with the translations:
(setf (logical-pathname-translations "clocc")
'(("**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
(";**;*.*.*" "/home/paolo/projects/clocc/**/*.*")
("*.*.*" "/home/paolo/lisp/clocc/")))
> I don't know what CLISP's problem is, though...
Your translations work fine with CLISP 2000-03-06, and it's not even
necessary to call LOGICAL-PATHNAME on the namestring.
I think we are converging :-) Thanks,
> Paolo's problem is that he was not setting the "wild inferiors" string
> in the translations.
Yes. I misunderstood the ability of CMU CL and CLISP to deal with wild
inferiors.
> As for CLisp, you should check the implementation notes and be sure
> that you have a recent version. Bruno and Sam fixed a few buglets wrt
> LPs very recently.
Pierre's translations work fine under CLISP 2000-03-06, the latest official
release. The release notes do mention some fixes to logical pathname bugs.
> Well, let me rephrase my question. Why do people write foo:;bar;h.h
> and not foo:bar;h.h? I've never seen this in books or the HyperSpec,
> but in some code.
Good question. I've seen it as well -- fairly widely used in fact --
and I'd like to know too.
--tim