User Tools


Differences

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

Link to this comparison view

cl:functions:truename [2019/11/11 05:00]
cl:functions:truename [2019/12/08 21:00] (current)
Line 1: Line 1:
 +====== Function TRUENAME ======
 +
 +====Syntax====
 +  * **truename** //​filespec//​ → //​truename//​
 +
 +====Arguments and Values====
 +  * //​filespec//​ - a //​[[CL:​Glossary:​pathname designator]]//​.
 +  * //​truename//​ - a //​[[CL:​Glossary:​physical pathname]]//​.
 +
 +====Description====
 +**truename** tries to find the //​[[CL:​Glossary:​file]]//​ indicated by //​filespec//​ and returns its //​[[CL:​Glossary:​truename]]//​.
 +
 +If the //​filespec//​ //​[[CL:​Glossary:​designator]]//​ is an open //​[[CL:​Glossary:​stream]]//,​ its associated //​[[CL:​Glossary:​file]]//​ is used.
 +
 +If //​filespec//​ is a //​[[CL:​Glossary:​stream]]//,​ **truename** can be used whether the //​[[CL:​Glossary:​stream]]//​ is open or closed. It is permissible for **truename** to return more specific information after the //​[[CL:​Glossary:​stream]]//​ is closed than when the //​[[CL:​Glossary:​stream]]//​ was open.
 +
 +If //​filespec//​ is a //​[[CL:​Glossary:​pathname]]//​ it represents the name used to open the file. This may be, but is not required to be, the actual name of the file.
 +
 +====Examples====
 +<​blockquote>​
 +;;; An example involving version numbers. Note that the precise nature of the
 +;;; truename is implementation-dependent while the file is still open.
 +([[CL:​Macros:​with-open-file]] (stream ">​vistor>​test.text.newest"​)
 +  ([[CL:​Functions:​values]] ([[CL:​Functions:​pathname]] stream) (truename stream)))
 +<​r>#​P"​S:>​vistor>​test.text.newest",​ #​P"​S:>​vistor>​test.text.1" ​
 +//or// #​P"​S:>​vistor>​test.text.newest",​ #​P"​S:>​vistor>​test.text.newest" ​
 +//or// #​P"​S:>​vistor>​test.text.newest",​ #​P"​S:>​vistor>​_temp_._temp_.1"</​r>​
 +
 +;;; In this case, the file is closed when the truename is tried, so the 
 +;;; truename information is reliable.
 +([[CL:​Macros:​with-open-file]] (stream ">​vistor>​test.text.newest"​)
 +  ([[CL:​Functions:​close]] stream)
 +  ([[CL:​Functions:​values]] ([[CL:​Functions:​pathname]] stream) (truename stream)))
 +<​r>#​P"​S:>​vistor>​test.text.newest",​ #​P"​S:>​vistor>​test.text.1"</​r>​
 +
 +;;; An example involving TOP-20'​s implementation-dependent concept of logical
 +;;; devices -- in this case, "​DOC:"​ is shorthand for "​PS:<​DOCUMENTATION>"​ ...
 +([[CL:​Macros:​with-open-file]] (stream "​CMUC::​DOC:​DUMPER.HLP"​)
 +  ([[CL:​Functions:​values]] ([[CL:​Functions:​pathname]] stream) (truename stream)))
 +<​r>#​P"​CMUC::​DOC:​DUMPER.HLP",​ #​P"​CMUC::​PS:<​DOCUMENTATION>​DUMPER.HLP.13"</​r>​
 +</​blockquote>​
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +An error of type **[[CL:​Types:​file-error]]** is signaled if an appropriate //​[[CL:​Glossary:​file]]//​ cannot be located within the //​[[CL:​Glossary:​file system]]// for the given //​filespec//,​
 +
 +or if the //​[[CL:​Glossary:​file system]]// cannot perform the requested operation.
 +
 +An error of type **[[CL:​Types:​file-error]]** is signaled if //​pathname//​ is //​[[CL:​Glossary:​wild]]//​.
 +
 +====See Also====
 +**[[CL:​Types:​pathname|System Class PATHNAME]]**,​ **[[CL:​Types:​logical-pathname|System Class LOGICAL-PATHNAME]]**,​ {\secref\FileSystemConcepts},​ {\secref\PathnamesAsFilenames}
 +
 +====Notes====
 +**truename** may be used to account for any //​[[CL:​Glossary:​filename]]//​ translations performed by the //​[[CL:​Glossary:​file system]]//.
 +
 +\issue{PATHNAME-LOGICAL:​ADD} \issue{PATHNAME-LOGICAL:​ADD} \issue{CLOSED-STREAM-FUNCTIONS:​ALLOW-INQUIRY} \issue{FILE-OPEN-ERROR:​SIGNAL-FILE-ERROR} \issue{FILE-OPEN-ERROR:​SIGNAL-FILE-ERROR} \issue{PATHNAME-WILD:​NEW-FUNCTIONS} \issue{PATHNAME-LOGICAL:​ADD} \issue{FILE-OPEN-ERROR:​SIGNAL-FILE-ERROR}