116 lines
6.5 KiB
HTML
116 lines
6.5 KiB
HTML
![]() |
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE>23.1.5.4. Examples of the Use of Logical Pathnames</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Examples of the Use of Logical Pathnames">
|
||
|
<meta name="keywords" value="clm">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<b>Common Lisp the Language, 2nd Edition</b>
|
||
|
<BR> <HR><A NAME=tex2html4208 HREF="node213.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4206 HREF="node208.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4200 HREF="node211.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4210 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4211 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html4209 HREF="node213.html"> Discussion of Logical </A>
|
||
|
<B>Up:</B> <A NAME=tex2html4207 HREF="node208.html"> Logical Pathnames</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html4201 HREF="node211.html"> Using Logical Pathnames</A>
|
||
|
<HR> <P>
|
||
|
<H3><A NAME=SECTION002715400000000000000>23.1.5.4. Examples of the Use of Logical Pathnames</A></H3>
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
Here is a very simple example of setting up a logical pathname host named <tt>FOO</tt>.
|
||
|
Suppose that 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 in the to-wildname is implementation-specific.
|
||
|
<P><pre>
|
||
|
(setf (logical-pathname-translations "foo")
|
||
|
'(("**;*.*.*" "MY-LISPM:>library>foo>**>")))
|
||
|
</pre><P>
|
||
|
The following is a sample use of that logical pathname. All return values
|
||
|
are of course implementation-specific; all of the examples in this section
|
||
|
are of course meant to be illustrative and not prescriptive.
|
||
|
<P><pre>
|
||
|
(translate-logical-pathname "foo:bar;baz;mum.quux.3")
|
||
|
=> #P"MY-LISPM:>library>foo>bar>baz>mum.quux.3"
|
||
|
</pre><P>
|
||
|
<P>
|
||
|
Next we have a more complex example, dividing the files among two file servers
|
||
|
(<tt>U</tt>, supporting a UNIX file system, and <tt>V</tt>, supporting a VAX/VMS file system)
|
||
|
and several different directories. This UNIX file system doesn't support
|
||
|
<tt>:wild-inferiors</tt> in the directory, so each directory level must
|
||
|
be translated individually. No file name or type translations
|
||
|
are required except for <tt>.MAIL</tt> to <tt>.MBX</tt>.
|
||
|
The namestring syntax used for the to-wildnames is implementation-specific.
|
||
|
<P><pre>
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
'(("RELEASED;*.*.*" "U:/sys/bin/my-prog/")
|
||
|
("RELEASED;*;*.*.*" "U:/sys/bin/my-prog/*/")
|
||
|
("EXPERIMENTAL;*.*.*"
|
||
|
"U:/usr/Joe/development/prog/")
|
||
|
("EXPERIMENTAL;DOCUMENTATION;*.*.*"
|
||
|
"V:SYS$DISK:[JOE.DOC]")
|
||
|
("EXPERIMENTAL;*;*.*.*"
|
||
|
"U:/usr/Joe/development/prog/*/")
|
||
|
("MAIL;**;*.MAIL" "V:SYS$DISK:[JOE.MAIL.PROG...]*.MBX")
|
||
|
))
|
||
|
</pre><P>
|
||
|
Here are sample uses of logical host <tt>PROG</tt>. All return values
|
||
|
are of course implementation-specific.
|
||
|
<P><pre>
|
||
|
(translate-logical-pathname "prog:mail;save;ideas.mail.3")
|
||
|
=> #P"V:SYS$DISK:[JOE.MAIL.PROG.SAVE]IDEAS.MBX.3"
|
||
|
|
||
|
(translate-logical-pathname "prog:experimental;spreadsheet.c")
|
||
|
=> #P"U:/usr/Joe/development/prog/spreadsheet.c"
|
||
|
</pre><P>
|
||
|
<P>
|
||
|
Suppose now that we have a program that uses three files logically named <tt>MAIN.LISP</tt>,
|
||
|
<tt>AUXILIARY.LISP</tt>, and <tt>DOCUMENTATION.LISP</tt>. The following translations might be
|
||
|
provided by a software supplier as examples.
|
||
|
<P>
|
||
|
For a UNIX file system with long file names:
|
||
|
<P><pre>
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
'(("CODE;*.*.*" "/lib/prog/")))
|
||
|
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"/lib/prog/documentation.lisp"
|
||
|
</pre><P>
|
||
|
For a UNIX file system with 14-character file names, using <tt>.lisp</tt> as the type:
|
||
|
<P><pre>
|
||
|
(setf (logical-pathname-translations "prog")
|
||
|
'(("CODE;DOCUMENTATION.*.*" "/lib/prog/docum.*")
|
||
|
("CODE;*.*.*" "/lib/prog/")))
|
||
|
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"/lib/prog/docum.lisp"
|
||
|
</pre><P>
|
||
|
For a UNIX file system with 14-character file names, using <tt>.l</tt> as the type
|
||
|
(the second translation shortens the compiled file type to <tt>.b</tt>):
|
||
|
<P><pre>
|
||
|
(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/")))
|
||
|
|
||
|
(translate-logical-pathname "prog:code;documentation.lisp")
|
||
|
=> #P"/lib/prog/documentatio.l"
|
||
|
</pre><P>
|
||
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<P>
|
||
|
<BR> <HR><A NAME=tex2html4208 HREF="node213.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4206 HREF="node208.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4200 HREF="node211.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4210 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4211 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html4209 HREF="node213.html"> Discussion of Logical </A>
|
||
|
<B>Up:</B> <A NAME=tex2html4207 HREF="node208.html"> Logical Pathnames</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html4201 HREF="node211.html"> Using Logical Pathnames</A>
|
||
|
<HR> <P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|