532 lines
No EOL
14 KiB
HTML
532 lines
No EOL
14 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>logical-pathname-translations | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="f_logical-pathname-translations.html"
|
|
><LINK REL="next" HREF="f_logical-pathname.html" TYPE="text/html" TITLE="logical-pathname"
|
|
><LINK REL="prev" HREF="f_load-logical-pathname-translations.html" TYPE="text/html" TITLE="load-logical-pathname-translations"
|
|
><LINK REL="up" HREF="19_4_Filenames_Dictionary.html" TYPE="text/html" TITLE="19.4 Filenames Dictionary"
|
|
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
|
|
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
|
|
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
|
|
><SCRIPT SRC="dpans.js%3F3909942064"
|
|
></SCRIPT
|
|
><SCRIPT SRC="apropos.js%3F3909942064"
|
|
></SCRIPT
|
|
></HEAD
|
|
><BODY
|
|
><DIV
|
|
><DIV CLASS="topnav"
|
|
><DIV CLASS="breadcrumb"
|
|
><SPAN CLASS="breadcrumb-item"
|
|
><A HREF="index.html"
|
|
>Common Lisp Nova Spec</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="19_Filenames.html"
|
|
>19. Filenames</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="19_4_Filenames_Dictionary.html"
|
|
>19.4 Filenames Dictionary</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="f_logical-pathname-translations.html"
|
|
>logical-pathname-translations</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="f_load-logical-pathname-translations.html" CLASS="prev"
|
|
>←</A
|
|
><SPAN ID="apropos-label"
|
|
>Apropos </SPAN
|
|
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
|
|
><A HREF="f_logical-pathname.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV ID="apropos-res"
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="matter"
|
|
><DIV CLASS="com"
|
|
><DIV CLASS="begincom"
|
|
><HR
|
|
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
|
|
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="logical-pathname-translations"
|
|
></SPAN
|
|
><B
|
|
>logical-pathname-translations</B
|
|
></TD
|
|
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
|
|
><I
|
|
>Accessor</I
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
></DIV
|
|
><UL CLASS="subtoc"
|
|
></UL
|
|
><DL
|
|
><DT
|
|
><B
|
|
>Syntax</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><B
|
|
>logical-pathname-translations</B
|
|
> <SPAN CLASS="cmssi"
|
|
>host</SPAN
|
|
> <SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
> <SPAN CLASS="cmssi"
|
|
>translations</SPAN
|
|
></P
|
|
><P CLASS="j"
|
|
><B
|
|
>(setf (logical-pathname-translations</B
|
|
> <SPAN CLASS="cmssi"
|
|
>host</SPAN
|
|
><B
|
|
>)</B
|
|
> <SPAN CLASS="cmssi"
|
|
>new-translations</SPAN
|
|
><B
|
|
>)</B
|
|
></P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Arguments and Values</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>host</VAR
|
|
>–a <A HREF="26_1_Glossary.html#logical_host_designator"
|
|
><EM CLASS="term"
|
|
>logical host designator</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>translations</VAR
|
|
>, <VAR CLASS="param"
|
|
>new-translations</VAR
|
|
> — a <A HREF="26_1_Glossary.html#list"
|
|
><EM CLASS="term"
|
|
>list</EM
|
|
></A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Description</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Returns the host’s <A HREF="26_1_Glossary.html#list"
|
|
><EM CLASS="term"
|
|
>list</EM
|
|
></A
|
|
> of translations. Each translation is a <A HREF="26_1_Glossary.html#list"
|
|
><EM CLASS="term"
|
|
>list</EM
|
|
></A
|
|
> of at least two elements: <I CLASS="i"
|
|
><I
|
|
>from-wildcard</I
|
|
></I
|
|
> and <I CLASS="i"
|
|
><I
|
|
>to-wildcard</I
|
|
></I
|
|
>. Any additional elements are <A HREF="26_1_Glossary.html#implementation-defined"
|
|
><EM CLASS="term"
|
|
>implementation-defined</EM
|
|
></A
|
|
>. <I CLASS="i"
|
|
><I
|
|
>From-wildcard</I
|
|
></I
|
|
> is a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> whose host is <VAR CLASS="param"
|
|
>host</VAR
|
|
>. <I CLASS="i"
|
|
><I
|
|
>To-wildcard</I
|
|
></I
|
|
> is a <A HREF="26_1_Glossary.html#pathname"
|
|
><EM CLASS="term"
|
|
>pathname</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>(setf (logical-pathname-translations <VAR CLASS="param"
|
|
>host</VAR
|
|
>) <I CLASS="i"
|
|
><I
|
|
>translations</I
|
|
></I
|
|
>)</CODE
|
|
> sets a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> host’s <A HREF="26_1_Glossary.html#list"
|
|
><EM CLASS="term"
|
|
>list</EM
|
|
></A
|
|
> of <I CLASS="i"
|
|
><I
|
|
>translations</I
|
|
></I
|
|
>. If <VAR CLASS="param"
|
|
>host</VAR
|
|
> is a <A HREF="26_1_Glossary.html#string"
|
|
><EM CLASS="term"
|
|
>string</EM
|
|
></A
|
|
> that has not been previously used as a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> host, a new <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> host is defined; otherwise an existing host’s translations are replaced. <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> host names are compared with <A HREF="f_string_eq.html" CLASS="funref"
|
|
><B
|
|
>string-equal</B
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>When setting the translations list, each <I CLASS="i"
|
|
><I
|
|
>from-wildcard</I
|
|
></I
|
|
> can be a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> whose host is <VAR CLASS="param"
|
|
>host</VAR
|
|
> or a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> namestring parseable by <CODE CLASS="f"
|
|
>(parse-namestring <A HREF="26_1_Glossary.html#string"
|
|
><EM CLASS="term"
|
|
>string</EM
|
|
></A
|
|
> <I CLASS="i"
|
|
><I
|
|
>host</I
|
|
></I
|
|
>)</CODE
|
|
>, where <I CLASS="i"
|
|
><I
|
|
>host</I
|
|
></I
|
|
> represents the appropriate <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> as defined by <A HREF="f_parse-namestring.html" CLASS="funref"
|
|
><B
|
|
>parse-namestring</B
|
|
></A
|
|
>. Each <I CLASS="i"
|
|
><I
|
|
>to-wildcard</I
|
|
></I
|
|
> can be anything coercible to a <A HREF="26_1_Glossary.html#pathname"
|
|
><EM CLASS="term"
|
|
>pathname</EM
|
|
></A
|
|
> by <CODE CLASS="f"
|
|
>(pathname <I CLASS="i"
|
|
><I
|
|
>to-wildcard</I
|
|
></I
|
|
>)</CODE
|
|
>. If <I CLASS="i"
|
|
><I
|
|
>to-wildcard</I
|
|
></I
|
|
> coerces to a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
>, <A HREF="f_translate-logical-pathname.html" CLASS="funref"
|
|
><B
|
|
>translate-logical-pathname</B
|
|
></A
|
|
> will perform repeated translation steps when it uses it. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>host</VAR
|
|
> is either the host component of a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> or a <A HREF="26_1_Glossary.html#string"
|
|
><EM CLASS="term"
|
|
>string</EM
|
|
></A
|
|
> that has been defined as a <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> host name by <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> of <A HREF="f_logical-pathname-translations.html" CLASS="funref"
|
|
><B
|
|
>logical-pathname-translations</B
|
|
></A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Examples</B
|
|
></DT
|
|
><DD
|
|
><PRE CLASS="screen"
|
|
> ;;;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")
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #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")
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #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")
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #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")
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #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")
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #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")
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #P"PGDOC"</PRE
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Exceptional Situations</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>If <VAR CLASS="param"
|
|
>host</VAR
|
|
> is incorrectly supplied, an error of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_type-error.html" CLASS="typeref"
|
|
><B
|
|
>type-error</B
|
|
></A
|
|
> is signaled.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>See Also</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><A HREF="t_logical-pathname.html" CLASS="typeref"
|
|
><B
|
|
>logical-pathname</B
|
|
></A
|
|
>, <A HREF="19_1_Overview_of_Filenames.html#sec_19_1_2" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>19.1.2</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Pathnames</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>as</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>Filenames)</SPAN
|
|
></A
|
|
></P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Notes</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Implementations can define additional <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>functions</EM
|
|
></A
|
|
> that operate on <A HREF="26_1_Glossary.html#logical_pathname"
|
|
><EM CLASS="term"
|
|
>logical pathname</EM
|
|
></A
|
|
> hosts, for example to specify additional translation rules or options.</P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="f_load-logical-pathname-translations.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="f_logical-pathname.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |