172 lines
13 KiB
HTML
172 lines
13 KiB
HTML
|
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE>CLHS: Accessor LOGICAL-PATHNAME-TRANSLATIONS</TITLE>
|
||
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
||
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
||
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
||
|
<LINK REL=TOP HREF="../Front/index.htm">
|
||
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
||
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
||
|
<LINK REL=PREV HREF="f_ld_log.htm">
|
||
|
<LINK REL=UP HREF="c_filena.htm">
|
||
|
<LINK REL=NEXT HREF="f_logi_1.htm">
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="f_ld_log.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_filena.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="f_logi_1.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
<A NAME="logical-pathname-translations"><I>Accessor</I> <B>LOGICAL-PATHNAME-TRANSLATIONS</B></A> <P>
|
||
|
<P>
|
||
|
<P><B>Syntax:</B><P>
|
||
|
<P>
|
||
|
|
||
|
<B>logical-pathname-translations</B> <I>host</I> => <I>translations</I><P>
|
||
|
|
||
|
<TT>(setf (</TT><B>logical-pathname-translations</B> <I>host</I><TT>) </TT><I>new-translations</I><TT>)</TT><P>
|
||
|
<P>
|
||
|
<P><B>Arguments and Values:</B><P>
|
||
|
<P>
|
||
|
<I>host</I>--a <A REL=DEFINITION HREF="26_glo_l.htm#logical_host_designator"><I>logical host designator</I></A>. <P>
|
||
|
<I>translations</I>, <I>new-translations</I>---a <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A>. <P>
|
||
|
<P><B>Description:</B><P>
|
||
|
<P>
|
||
|
Returns the host's <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A> of translations. Each translation is a <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A> of at least two elements: <I>from-wildcard</I> and <I>to-wildcard</I>. Any additional elements are <A REL=DEFINITION HREF="26_glo_i.htm#implementation-defined"><I>implementation-defined</I></A>. <I>From-wildcard</I> is a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> whose host is <I>host</I>. <I>To-wildcard</I> is a <A REL=DEFINITION HREF="26_glo_p.htm#pathname"><I>pathname</I></A>. <P>
|
||
|
<TT>(setf (logical-pathname-translations </TT><I>host</I><TT>) </TT><I>translations</I><TT>)</TT> sets a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> host's <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A> of <I>translations</I>. If <I>host</I> is a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> that has not been previously used as a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> host, a new <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> host is defined; otherwise an existing host's translations are replaced. <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> host names are compared with <A REL=DEFINITION HREF="f_stgeq_.htm#string-equal"><B>string-equal</B></A>. <P>
|
||
|
When setting the translations list, each <I>from-wildcard</I> can be a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> whose host is <I>host</I> or a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> namestring parseable by <TT>(parse-namestring <A REL=DEFINITION HREF="26_glo_s.htm#string"></TT><I>string</I><TT></A> </TT><I>host</I><TT>)</TT>, where <I>host</I> represents the appropriate <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> as defined by <A REL=DEFINITION HREF="f_pars_1.htm#parse-namestring"><B>parse-namestring</B></A>. Each <I>to-wildcard</I> can be anything coercible to a <A REL=DEFINITION HREF="26_glo_p.htm#pathname"><I>pathname</I></A> by <TT>(pathname </TT><I>to-wildcard</I><TT>)</TT>. If <I>to-wildcard</I> coerces to a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A>, <A REL=DEFINITION HREF="f_tr_log.htm#translate-logical-pathname"><B>translate-logical-pathname</B></A> will perform repeated translation steps when it uses it. <P>
|
||
|
<I>host</I> is either the host component of a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> or a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> that has been defined as a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> host name by <A REL=DEFINITION HREF="m_setf_.htm#setf"><B>setf</B></A> of <A REL=DEFINITION HREF="#logical-pathname-translations"><B>logical-pathname-translations</B></A>. <P>
|
||
|
<P><B>Examples:</B><P>
|
||
|
<P>
|
||
|
<P>
|
||
|
<PRE>
|
||
|
;;;A very simple example of setting up a logical pathname host. No
|
||
|
;;;translations are necessary to get around file system restrictions, so
|
||
|
;;;all that is necessary is to specify the root of the physical directory
|
||
|
;;;tree that contains the logical file system.
|
||
|
;;;The namestring syntax on the right-hand side is implementation-dependent.
|
||
|
(setf (logical-pathname-translations "foo")
|
||
|
'(("**;*.*.*" "MY-LISPM:>library>foo>**>")))
|
||
|
|
||
|
;;;Sample use of that logical pathname. The return value
|
||
|
;;;is implementation-dependent.
|
||
|
(translate-logical-pathname "foo:bar;baz;mum.quux.3")
|
||
|
=> #P"MY-LISPM:>library>foo>bar>baz>mum.quux.3"
|
||
|
|
||
|
;;;A more complex example, dividing the files among two file servers
|
||
|
;;;and several different directories. This Unix doesn't support
|
||
|
;;;:WILD-INFERIORS in the directory, so each directory level must
|
||
|
;;;be translated individually. No file name or type translations
|
||
|
;;;are required except for .MAIL to .MBX.
|
||
|
;;;The namestring syntax on the right-hand side is implementation-dependent.
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
'(("RELEASED;*.*.*" "MY-UNIX:/sys/bin/my-prog/")
|
||
|
("RELEASED;*;*.*.*" "MY-UNIX:/sys/bin/my-prog/*/")
|
||
|
("EXPERIMENTAL;*.*.*" "MY-UNIX:/usr/Joe/development/prog/")
|
||
|
("EXPERIMENTAL;DOCUMENTATION;*.*.*"
|
||
|
"MY-VAX:SYS$DISK:[JOE.DOC]")
|
||
|
("EXPERIMENTAL;*;*.*.*" "MY-UNIX:/usr/Joe/development/prog/*/")
|
||
|
("MAIL;**;*.MAIL" "MY-VAX:SYS$DISK:[JOE.MAIL.PROG...]*.MBX")))
|
||
|
|
||
|
;;;Sample use of that logical pathname. The return value
|
||
|
;;;is implementation-dependent.
|
||
|
(translate-logical-pathname "prog:mail;save;ideas.mail.3")
|
||
|
=> #P"MY-VAX:SYS$DISK:[JOE.MAIL.PROG.SAVE]IDEAS.MBX.3"
|
||
|
|
||
|
;;;Example translations for a program that uses three files main.lisp,
|
||
|
;;;auxiliary.lisp, and documentation.lisp. These translations might be
|
||
|
;;;supplied by a software supplier as examples.
|
||
|
|
||
|
;;;For Unix with long file names
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
'(("CODE;*.*.*" "/lib/prog/")))
|
||
|
|
||
|
;;;Sample use of that logical pathname. The return value
|
||
|
;;;is implementation-dependent.
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"/lib/prog/documentation.lisp"
|
||
|
|
||
|
;;;For Unix with 14-character file names, using .lisp as the type
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
'(("CODE;DOCUMENTATION.*.*" "/lib/prog/docum.*")
|
||
|
("CODE;*.*.*" "/lib/prog/")))
|
||
|
|
||
|
;;;Sample use of that logical pathname. The return value
|
||
|
;;;is implementation-dependent.
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"/lib/prog/docum.lisp"
|
||
|
|
||
|
;;;For Unix with 14-character file names, using .l as the type
|
||
|
;;;The second translation shortens the compiled file type to .b
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
`(("**;*.LISP.*" ,(logical-pathname "PROG:**;*.L.*"))
|
||
|
(,(compile-file-pathname (logical-pathname "PROG:**;*.LISP.*"))
|
||
|
,(logical-pathname "PROG:**;*.B.*"))
|
||
|
("CODE;DOCUMENTATION.*.*" "/lib/prog/documentatio.*")
|
||
|
("CODE;*.*.*" "/lib/prog/")))
|
||
|
|
||
|
;;;Sample use of that logical pathname. The return value
|
||
|
;;;is implementation-dependent.
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"/lib/prog/documentatio.l"
|
||
|
|
||
|
;;;For a Cray with 6 character names and no directories, types, or versions.
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
(let ((l '(("MAIN" "PGMN")
|
||
|
("AUXILIARY" "PGAUX")
|
||
|
("DOCUMENTATION" "PGDOC")))
|
||
|
(logpath (logical-pathname "prog:code;"))
|
||
|
(phypath (pathname "XXX")))
|
||
|
(append
|
||
|
;; Translations for source files
|
||
|
(mapcar #'(lambda (x)
|
||
|
(let ((log (first x))
|
||
|
(phy (second x)))
|
||
|
(list (make-pathname :name log
|
||
|
:type "LISP"
|
||
|
:version :wild
|
||
|
:defaults logpath)
|
||
|
(make-pathname :name phy
|
||
|
:defaults phypath))))
|
||
|
l)
|
||
|
;; Translations for compiled files
|
||
|
(mapcar #'(lambda (x)
|
||
|
(let* ((log (first x))
|
||
|
(phy (second x))
|
||
|
(com (compile-file-pathname
|
||
|
(make-pathname :name log
|
||
|
:type "LISP"
|
||
|
:version :wild
|
||
|
:defaults logpath))))
|
||
|
(setq phy (concatenate 'string phy "B"))
|
||
|
(list com
|
||
|
(make-pathname :name phy
|
||
|
:defaults phypath))))
|
||
|
l))))
|
||
|
|
||
|
;;;Sample use of that logical pathname. The return value
|
||
|
;;;is implementation-dependent.
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"PGDOC"
|
||
|
</PRE>
|
||
|
</TT> <P>
|
||
|
<P><B>Affected By:</B> None.
|
||
|
<P>
|
||
|
<P><B>Exceptional Situations:</B><P>
|
||
|
<P>
|
||
|
If <I>host</I> is incorrectly supplied, an error of <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="e_tp_err.htm#type-error"><B>type-error</B></A> is signaled. <P>
|
||
|
<P><B>See Also:</B><P>
|
||
|
<P>
|
||
|
<A REL=DEFINITION HREF="t_logica.htm#logical-pathname"><B>logical-pathname</B></A>, <A REL=CHILD HREF="19_ab.htm">Section 19.1.2 (Pathnames as Filenames)</A> <P>
|
||
|
<P><B>Notes:</B><P>
|
||
|
<P>
|
||
|
Implementations can define additional <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>functions</I></A> that operate on <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> hosts, for example to specify additional translation rules or options. <P>
|
||
|
<P>
|
||
|
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss157.htm">FILE-OPEN-ERROR:SIGNAL-FILE-ERROR</A><LI> <A REL=CHILD HREF="../Issues/iss259.htm">PATHNAME-LOGICAL:ADD</A><P></UL><HR>
|
||
|
|
||
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
||
|
|
||
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
||
|
</BODY>
|
||
|
</HTML>
|