User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:make-pathname [2019/06/15 02:00]
cl:functions:make-pathname [2019/06/18 09:00] (current)
Line 1: Line 1:
 +====== Function MAKE-PATHNAME ======
 +
 +====Syntax====
 +  * //​make-pathname//​ ''&​key''​ //host// //device// //​directory//​ //name// //type// //version// //​defaults//​ //case// → //​pathname//​
 +
 +====Arguments and Values====
 +  * //host// - a //​[[CL:​Glossary:​valid physical pathname host]]//. Complicated defaulting behavior; see below.
 +  * //device// - a //​[[CL:​Glossary:​valid pathname device]]//. Complicated defaulting behavior; see below.
 +  * //​directory//​ - a //​[[CL:​Glossary:​valid pathname directory]]//​. Complicated defaulting behavior; see below.
 +  * //name// - a //​[[CL:​Glossary:​valid pathname name]]//. Complicated defaulting behavior; see below.
 +  * //type// - a //​[[CL:​Glossary:​valid pathname type]]//. Complicated defaulting behavior; see below.
 +  * //version// - a //​[[CL:​Glossary:​valid pathname version]]//​. Complicated defaulting behavior; see below.
 +  * //​defaults//​ - a //​[[CL:​Glossary:​pathname designator]]//​. The default is a //​[[CL:​Glossary:​pathname]]//​ whose host component is the same as the host component of the //​[[CL:​Glossary:​value]]//​ of [[CL:​Variables:​star-default-pathname-defaults-star|*default-pathname-defaults*]],​ and whose other components are all **[[CL:​Constant Variables:​nil]]**.
 +  * //case// - one of **'':​common''​** or **'':​local''​**. The default is **'':​local''​**.
 +  * //​pathname//​ - a //​[[CL:​Glossary:​pathname]]//​.
 +
 +====Description====
 +Constructs and returns a //​[[CL:​Glossary:​pathname]]//​ from the supplied keyword arguments.
 +
 +After the components supplied explicitly by //host//, //device//, //​directory//,​ //name//, //type//, and //version// are filled in, the merging rules used by **[[CL:​Functions:​merge-pathnames]]** are used to fill in any unsupplied components from the defaults supplied by //​defaults//​.
 +
 +Whenever a //​[[CL:​Glossary:​pathname]]//​ is constructed the components may be canonicalized if appropriate. For the explanation of the arguments that can be supplied for each component, see section {\secref\PathnameComponents}.
 +
 +If //case// is supplied, it is treated as described in \secref\PathnameComponentCase.
 +
 +The resulting //​pathname//​ is a //​[[CL:​Glossary:​logical pathname]]//​ if and only its host component is a //​[[CL:​Glossary:​logical host]]// or a //​[[CL:​Glossary:​string]]//​ that names a defined //​[[CL:​Glossary:​logical host]]//.
 +
 +If the //​directory//​ is a //​[[CL:​Glossary:​string]]//,​ it should be the name of a top level directory, and should not contain any punctuation characters; that is, specifying a //​[[CL:​Glossary:​string]]//,​ //str//, is equivalent to specifying the list ''​(:​absolute //​str//​)''​. Specifying the symbol **'':​wild''​** is equivalent to specifying the list ''​(:​absolute :​wild-inferiors)'',​ or ''​(:​absolute :​wild)''​ in a file system that does not support **'':​wild-inferiors''​**.
 +
 +====Examples====
 +//​[[CL:​Glossary:​Implementation]]//​ A - an //​[[CL:​Glossary:​implementation]]//​ with access to a single Unix //​[[CL:​Glossary:​file system]]//. This //​[[CL:​Glossary:​implementation]]//​ happens to never display the host information in a namestring, since there is only one host. 
 +
 +<​blockquote> ​
 +(make-pathname :directory '​(:​absolute "​public"​ "​games"​) ​
 +               :name "​chess" ​
 +               :type "​db"​) <​r>#​P"/​public/​games/​chess.db"</​r>​
 +</​blockquote> ​
 +
 +//​[[CL:​Glossary:​Implementation]]//​ B - an //​[[CL:​Glossary:​implementation]]//​ with access to one or more VMS //​[[CL:​Glossary:​file system|file systems]]//​. This implementation displays host information in the //​[[CL:​Glossary:​namestring]]//​ only when the host is not the local host. It uses a double colon to separate a host name from the host's local file name.
 +
 +<​blockquote> ​
 +(make-pathname :directory '​(:​absolute "​PUBLIC"​ "​GAMES"​) ​
 +               :name "​CHESS" ​
 +               :type "​DB"​) <​r>#​P"​SYS''​DISK:​[PUBLIC.GAMES]CHESS.DB"</​r>​
 +(make-pathname :host "​BOBBY" ​
 +               :​directory '​(:​absolute "​PUBLIC"​ "​GAMES"​) ​
 +               :name "​CHESS" ​
 +               :type "​DB"​) <​r>#​P"​BOBBY::​SYS''​DISK:​[PUBLIC.GAMES]CHESS.DB"</​r>​
 +</​blockquote> ​
 +
 +//​[[CL:​Glossary:​Implementation]]//​ C - an //​[[CL:​Glossary:​implementation]]//​ with simultaneous access to multiple //​[[CL:​Glossary:​file system|file systems]]// from the same //​[[CL:​Glossary:​Lisp image]]//. In this //​[[CL:​Glossary:​implementation]]//,​ there is a convention that any text preceding the first colon in a //​[[CL:​Glossary:​pathname]]//​ //​[[CL:​Glossary:​namestring]]//​ is a host name.
 + 
 +<​blockquote> ​
 +([[CL:​Special Operators:​dolist]] (case '​(:​common :​local)) ​
 +  ([[CL:​Special Operators:​dolist]] (host '​("​MY-LISPM"​ "​MY-VAX"​ "​MY-UNIX"​)) ​
 +    ([[CL:​Functions:​print]] (make-pathname :host host 
 +                          :case case 
 +                          :directory '​(:​absolute "​PUBLIC"​ "​GAMES"​) ​
 +                          :name "​CHESS"​ :type "​DB"​))))
 +<​o>#​P"​MY-LISPM:>​public>​games>​chess.db"​
 +#​P"​MY-VAX:​SYS$DISK:​[PUBLIC.GAMES]CHESS.DB"​
 +#​P"​MY-UNIX:/​public/​games/​chess.db"​
 +#​P"​MY-LISPM:>​public>​games>​chess.db" ​
 +#​P"​MY-VAX:​SYS$DISK:​[PUBLIC.GAMES]CHESS.DB" ​
 +#​P"​MY-UNIX:/​PUBLIC/​GAMES/​CHESS.DB"​ </o>
 +<​r>​[[CL:​Constant Variables:​NIL]]</​r>​
 +</​blockquote>​
 +
 +====Affected By====
 +The //​[[CL:​Glossary:​file system]]//.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Functions:​merge-pathnames|Function MERGE-PATHNAMES]]**
 +  * **[[CL:​Types:​pathname|System Class PATHNAME]]**
 +  * **[[CL:​Types:​logical-pathname|System Class LOGICAL-PATHNAME]]**
 +  * {\secref\FileSystemConcepts}
 +  * {\secref\PathnamesAsFilenames}
 +
 +====Notes====
 +Portable programs should not supply **'':​unspecific''​** for any component. See section {\secref\UnspecificComponent}.
 +
 +\issue{PATHNAME-UNSPECIFIC-COMPONENT:​NEW-TOKEN} \issue{PATHNAME-COMPONENT-CASE:​KEYWORD-ARGUMENT} \issue{PATHNAME-COMPONENT-CASE:​KEYWORD-ARGUMENT} \issue{PATHNAME-HOST-PARSING:​RECOGNIZE-LOGICAL-HOST-NAMES} \issue{PATHNAME-LOGICAL:​ADD} \issue{PATHNAME-SUBDIRECTORY-LIST:​NEW-REPRESENTATION} \issue{PATHNAME-LOGICAL:​ADD} \issue{FILE-OPEN-ERROR:​SIGNAL-FILE-ERROR}