concept-pathnames.tex 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. % -*- Mode: TeX -*-
  2. \beginSubsection{Pathname Components}
  3. \DefineSection{PathnameComponents}
  4. % \long\def\possiblecomponentvalues#1{\goodbreak
  5. % Possible values for this component:\par
  6. % \beginlist\par#1\par
  7. % \itemitem{\nil, \kwd{wild}, or \kwd{unspecific}}\par
  8. % See details and restrictions in \secref\SpecialComponentValues.\par
  9. % \endlist\par}
  10. %
  11. % \possiblecomponentvalues{\itemitem{...}\par...}
  12. A \term{pathname} has six components:
  13. a host,
  14. a device,
  15. a directory,
  16. a name,
  17. a type,
  18. and a version.
  19. %% 23.1.1 4
  20. %% 23.1.1 5
  21. %% 23.1.1 17
  22. \beginsubsubsection{The Pathname Host Component}
  23. The name of the file system on which the file resides,
  24. or the name of a \term{logical host}.
  25. %\possiblecomponentvalues{\itemitem{...}\par...}
  26. \endsubsubsection%{The Pathname Host Component}
  27. \beginsubsubsection{The Pathname Device Component}
  28. Corresponds to the ``device'' or ``file structure'' concept in many
  29. host file systems: the name of a logical or physical device containing files.
  30. %\possiblecomponentvalues{\itemitem{...}\par...}
  31. \endsubsubsection%{The Pathname Device Component}
  32. %% 23.1.1 6
  33. \beginsubsubsection{The Pathname Directory Component}
  34. Corresponds to the ``directory'' concept in many host file systems:
  35. the name of a group of related files.
  36. %\possiblecomponentvalues{\itemitem{...}\par...}
  37. \endsubsubsection%{The Pathname Directory Component}
  38. %% 23.1.1 7
  39. \beginsubsubsection{The Pathname Name Component}
  40. The ``name'' part of a group of \term{files} that can be thought of
  41. as conceptually related.
  42. %\possiblecomponentvalues{\itemitem{...}\par...}
  43. \endsubsubsection%{The Pathname Name Component}
  44. %% 23.1.1 8
  45. %% 23.1.1 15
  46. \beginsubsubsection{The Pathname Type Component}
  47. Corresponds to the ``filetype'' or ``extension'' concept in many host
  48. file systems. This says what kind of file this is.
  49. This component is always a \term{string}, \nil, \kwd{wild}, or \kwd{unspecific}.
  50. %\possiblecomponentvalues{\itemitem{...}\par...}
  51. \endsubsubsection%{The Pathname Type Component}
  52. %% 23.1.1 9
  53. %% 23.1.1 16
  54. \beginsubsubsection{The Pathname Version Component}
  55. Corresponds to the ``version number'' concept in many host file systems.
  56. The version is either a positive \term{integer}
  57. or a \term{symbol} from the following list:
  58. \nil, \kwd{wild}, \kwd{unspecific}, or \kwd{newest}
  59. (refers to the largest version number that already exists in
  60. the file system when reading a file, or to
  61. a version number
  62. greater than any already existing in the file system
  63. when writing a new file). Implementations
  64. can define other special version \term{symbols}.
  65. %\possiblecomponentvalues{\itemitem{...}\par...}
  66. \endsubsubsection%{The Pathname Version Component}
  67. \endSubsection%{Pathname Components}
  68. \beginSubsection{Interpreting Pathname Component Values}
  69. \beginsubsubsection{Strings in Component Values}
  70. \issue{PATHNAME-COMPONENT-VALUE:SPECIFY}
  71. \beginsubsubsubsection{Special Characters in Pathname Components}
  72. \term{Strings} in \term{pathname} component values
  73. never contain special \term{characters} that represent
  74. separation between \term{pathname} fields,
  75. such as \term{slash} in \Unix\ \term{filenames}.
  76. Whether separator \term{characters} are permitted as
  77. part of a \term{string} in a \term{pathname} component
  78. is \term{implementation-defined};
  79. however, if the \term{implementation} does permit it,
  80. it must arrange to properly ``quote'' the character for the
  81. \term{file system} when constructing a \term{namestring}.
  82. For example,
  83. \code
  84. ;; In a TOPS-20 implementation, which uses {\hat}V to quote
  85. (NAMESTRING (MAKE-PATHNAME :HOST "OZ" :NAME "<TEST>"))
  86. \EV #P"OZ:PS:{\hat}V<TEST{\hat}V>"
  87. \NV #P"OZ:PS:<TEST>"
  88. \endcode
  89. %Such punctuation \term{characters} appear only in \term{namestrings}.
  90. %Characters used as punctuation can appear in \term{pathname} component values
  91. %with a non-punctuation meaning if the file system allows it
  92. %(\eg a \Unix\ file name that begins with a dot).
  93. \endsubsubsubsection%{Special Characters in Pathname Components}
  94. \endissue{PATHNAME-COMPONENT-VALUE:SPECIFY}
  95. \issue{PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT}
  96. \beginsubsubsubsection{Case in Pathname Components}
  97. \DefineSection{PathnameComponentCase}
  98. \term{Namestrings} always use local file system \term{case} conventions,
  99. but \clisp\ \term{functions} that manipulate \term{pathname} components
  100. allow the caller to select either of two conventions for representing
  101. \term{case} in component values by supplying a value for the
  102. \kwd{case} keyword argument.
  103. %Added per Loosemore #32, first public review -kmp 26-Jun-93
  104. \Thenextfigure\ lists the functions
  105. relating to \term{pathnames} that permit a \kwd{case} argument:
  106. \DefineFigure{PathnameCaseFuns}
  107. \displaythree{Pathname functions using a :CASE argument}{
  108. make-pathname&pathname-directory&pathname-name\cr
  109. pathname-device&pathname-host&pathname-type\cr
  110. }
  111. \beginsubsubsubsubsection{Local Case in Pathname Components}
  112. For the functions in \figref\PathnameCaseFuns,
  113. a value of \kwd{local}\idxkwd{local} for the \kwd{case} argument
  114. (the default for these functions)
  115. indicates that the functions should receive and yield \term{strings} in component values
  116. as if they were already represented according to the host \term{file system}'s
  117. convention for \term{case}.
  118. If the \term{file system} supports both \term{cases}, \term{strings} given or received
  119. as \term{pathname} component values under this protocol are to be used exactly
  120. as written. If the file system only supports one \term{case},
  121. the \term{strings} will be translated to that \term{case}.
  122. \endsubsubsubsubsection%{Local Case in Pathname Components}
  123. \beginsubsubsubsubsection{Common Case in Pathname Components}
  124. For the functions in \figref\PathnameCaseFuns,
  125. a value of \kwd{common}\idxkwd{common} for the \kwd{case} argument
  126. that these \term{functions} should receive
  127. and yield \term{strings} in component values according to the following conventions:
  128. \beginlist
  129. \itemitem{\bull}
  130. All \term{uppercase} means to use a file system's customary \term{case}.
  131. \itemitem{\bull}
  132. All \term{lowercase} means to use the opposite of the customary \term{case}.
  133. \itemitem{\bull}
  134. Mixed \term{case} represents itself.
  135. \endlist
  136. Note that these conventions have been chosen in such a way that translation
  137. from \kwd{local} to \kwd{common} and back to \kwd{local} is information-preserving.
  138. \endsubsubsubsubsection%{Common Case in Pathname Components}
  139. \endsubsubsubsection%{Case in Pathname Components}
  140. \endissue{PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT}
  141. \endsubsubsection%{Strings in Component Values}
  142. \beginsubsubsection{Special Pathname Component Values}
  143. \DefineSection{SpecialComponentValues}
  144. \beginsubsubsubsection{NIL as a Component Value}
  145. % Bullet 1 from ``Restrictions on Examining Pathname Components''
  146. % said something similar I've consolidated the two here. -kmp 30-Aug-93
  147. As a \term{pathname} component value,
  148. \nil represents that the component is ``unfilled'';
  149. \seesection\MergingPathnames.
  150. The value of any \term{pathname} component can be \nil.
  151. %% This came from bullet 1 of ``Restrictions on Constructing Pathnames''
  152. When constructing a \term{pathname},
  153. \nil\ in the host component might mean a default host
  154. rather than an actual \nil\ in some \term{implementations}.
  155. \endsubsubsubsection%{NIL as a Component Value}
  156. \issue{PATHNAME-COMPONENT-VALUE:SPECIFY}
  157. \beginsubsubsubsection{:WILD as a Component Value}
  158. \DefineSection{WildComponents}
  159. If \kwd{wild}\idxkwd{wild} is the value of a \term{pathname} component,
  160. that component is considered to be a wildcard, which matches anything.
  161. A \term{conforming program} must be prepared to encounter a value of \kwd{wild}
  162. as the value of any \term{pathname} component,
  163. or as an \term{element} of a \term{list} that is the value of the directory component.
  164. \issue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION}
  165. When constructing a \term{pathname},
  166. a \term{conforming program} may use \kwd{wild} as the value of any or all of
  167. the directory, name, type,
  168. or version component, but must not use \kwd{wild} as the value of the host,
  169. %% "version" commented out per Barmar--
  170. %% PATHNAME-COMPONENT-VALUE:SPECIFY says that wild versions are permitted.
  171. %device, or version
  172. or device component.
  173. If \kwd{wild} is used as the value of the directory component in the construction
  174. of a \term{pathname}, the effect is equivalent to specifying the list
  175. \f{(:absolute :wild-inferiors)},
  176. or the same as \f{(:absolute :wild)} in a \term{file system} that does not support
  177. \kwd{wild-inferiors}.\idxkwd{wild-inferiors}
  178. \endissue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION}
  179. \endsubsubsubsection%{:WILD as a Component Value}
  180. \endissue{PATHNAME-COMPONENT-VALUE:SPECIFY}
  181. \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  182. \beginsubsubsubsection{:UNSPECIFIC as a Component Value}
  183. \DefineSection{UnspecificComponent}
  184. If \kwd{unspecific}\idxkwd{unspecific} is the value of a \term{pathname} component,
  185. the component is considered to be ``absent''
  186. % Part of bullet 2 of ``Restrictions on Examining Pathname Components''
  187. or to ``have no meaning''
  188. in the \term{filename} being represented by the \term{pathname}.
  189. Whether a value of \kwd{unspecific} is permitted for any component
  190. on any given \term{file system} accessible to the \term{implementation}
  191. is \term{implementation-defined}.
  192. A \term{conforming program} must never unconditionally use a
  193. \kwd{unspecific} as the value of a \term{pathname} component because
  194. such a value is not guaranteed to be permissible in all implementations.
  195. However, a \term{conforming program} can, if it is careful,
  196. successfully manipulate user-supplied data
  197. which contains or refers to non-portable \term{pathname} components.
  198. And certainly a \term{conforming program} should be prepared for the
  199. possibility that any components of a \term{pathname} could be \kwd{unspecific}.
  200. \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  201. % Part of bullet 2 of ``Restrictions on Examining Pathname Components''
  202. When \term{reading}\meaning{1} the value of any \term{pathname} component,
  203. \term{conforming programs} should be prepared for the value to be \kwd{unspecific}.
  204. \endissue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  205. \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  206. When \term{writing}\meaning{1} the value of any \term{pathname} component,
  207. the consequences are undefined if \kwd{unspecific} is given
  208. for a \term{pathname} in a \term{file system} for which it does not make sense.
  209. \endissue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  210. \beginsubsubsubsubsection{Relation between component values NIL and :UNSPECIFIC}
  211. %% Redundant. -kmp 30-Aug-93
  212. % Note that this is similar to a value of \nil\ in that it
  213. % does not supply a value for the component, but it is different
  214. % because the component is considered to have been filled.
  215. %% Moved from bullet 2 of ``Restrictions on Examining Pathname Components''
  216. \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  217. If a \term{pathname} is converted to a \term{namestring},
  218. the \term{symbols} \nil\ and \kwd{unspecific}
  219. cause the field to be treated as if it were empty.
  220. That is,
  221. both \nil\ and \kwd{unspecific}
  222. cause the component not to appear in the \term{namestring}.
  223. However, when merging a \term{pathname} with a set of defaults,
  224. only a \nil\ value for a component
  225. will be replaced with the default for that component,
  226. while a value of \kwd{unspecific}
  227. will be left alone as if the field were ``filled'';
  228. \seefun{merge-pathnames} and \secref\MergingPathnames.
  229. \endissue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  230. \endsubsubsubsubsection%{Relation between component values NIL and :UNSPECIFIC}
  231. \endsubsubsubsection%{:UNSPECIFIC as a Component Value}
  232. \endissue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  233. \endsubsubsection%{Special Pathname Component Values}
  234. \endsubsubsection%{Restrictions on Examining Pathname Components}
  235. \beginsubsubsection{Restrictions on Wildcard Pathnames}
  236. \DefineSection{WildcardRestrictions}
  237. Wildcard \term{pathnames} can be used with \funref{directory} but not with
  238. \funref{open},
  239. %!!! Laddaga: LOAD?
  240. and return true from \funref{wild-pathname-p}. When examining
  241. wildcard components of a wildcard \term{pathname}, conforming programs
  242. must be prepared to encounter any of the following additional values
  243. in any component or any element of a \term{list} that is the directory component:
  244. \beginlist
  245. \itemitem{\bull} The \term{symbol} \kwd{wild}, which matches anything.
  246. \itemitem{\bull} A \term{string} containing \term{implementation-dependent}
  247. special wildcard \term{characters}.
  248. \itemitem{\bull} Any \term{object},
  249. representing an \term{implementation-dependent} wildcard pattern.
  250. \endlist
  251. \endsubsubsection%{Restrictions on Wildcard Pathnames}
  252. \issue{PATHNAME-COMPONENT-VALUE:SPECIFY}
  253. \beginsubsubsection{Restrictions on Examining Pathname Components}
  254. The space of possible \term{objects} that a \term{conforming program}
  255. must be prepared to \term{read}\meaning{1}
  256. as the value of a \term{pathname} component
  257. is substantially larger than the space of possible \term{objects}
  258. that a \term{conforming program} is permitted to \term{write}\meaning{1}
  259. into such a component.
  260. While the values discussed
  261. in the subsections of this section,
  262. in {\secref\SpecialComponentValues},
  263. and in {\secref\WildcardRestrictions}
  264. apply to values that might be seen when
  265. reading the component values,
  266. substantially more restrictive rules apply to constructing pathnames;
  267. \seesection\ConstructingPathnames.
  268. When examining \term{pathname} components,
  269. \term{conforming programs} should be aware of the following restrictions.
  270. % \beginlist
  271. %
  272. % %% Consolidated with ``NIL as a Component Value'' above.
  273. % % \itemitem{\bull} Any component can be \nil, ...
  274. %
  275. % %% Consolidated with ``:UNSPECIFIC as a Component Value'' above.
  276. % % \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  277. % % \itemitem{\bull} Any component can be \kwd{unspecific}, ...
  278. % % \endissue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}
  279. %
  280. % %% Moved to various sections below.
  281. % %\itemitem{\bull} The device, directory, name, and type can be \term{strings}.
  282. %
  283. % %% Moved to new section farther down.
  284. % % \itemitem{\bull}
  285. % % It is \term{implementation-dependent} what \term{object}
  286. % % is used to represent the host.
  287. %
  288. % %% Moved to new section below.
  289. % % \itemitem{\bull}
  290. % % The directory can be a \term{list} of \term{strings} and \term{symbols}.
  291. % % [...]
  292. %
  293. % %% Moved to new section below.
  294. % % \itemitem{\bull} The version can be any \term{symbol} or any \term{integer}.
  295. %
  296. % \endlist
  297. \beginsubsubsubsection{Restrictions on Examining a Pathname Host Component}
  298. It is \term{implementation-dependent} what \term{object} is used to represent the host.
  299. \endsubsubsubsection%{Restrictions on Examining a Pathname Host Component}
  300. \beginsubsubsubsection{Restrictions on Examining a Pathname Device Component}
  301. %% From bullet 3 of ``Restrictions on Examining Pathname Components''
  302. %% the way it used to be arranged.
  303. The device might be a \term{string},
  304. % These came from other sections earlier -kmp 30-Aug-93
  305. \kwd{wild}, \kwd{unspecific}, or \nil.
  306. Note that \kwd{wild} might result from an attempt to \term{read}\meaning{1}
  307. the \term{pathname} component, even though portable programs are restricted
  308. from \term{writing}\meaning{1} such a component value;
  309. \seesection\WildcardRestrictions\ and \secref\ConstructingPathnames.
  310. \endsubsubsubsection%{Restrictions on Examining a Pathname Device Component}
  311. \beginsubsubsubsection{Restrictions on Examining a Pathname Directory Component}
  312. %% From bullet 3 of ``Restrictions on Examining Pathname Components''
  313. %% the way it used to be arranged.
  314. The directory might be a \term{string},
  315. %%!!! Laddaga:
  316. %% But cannot cannot contain directory separators. Or, put another way, if
  317. %% a directory component is a string, it can only name a simple level of
  318. %% directory structure? This doesn't seem right, but otherwise rule 1 is violated.
  319. %% Perhaps directory here is an error?
  320. %
  321. %% These came from other sections earlier -kmp 30-Aug-93
  322. \kwd{wild}, \kwd{unspecific}, or \nil.
  323. The directory can be a \term{list} of \term{strings} and \term{symbols}.
  324. \issue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION}
  325. The \term{car} of the \term{list} is one of the symbols \kwd{absolute}\idxkwd{absolute} or
  326. \kwd{relative}\idxkwd{relative}, meaning:
  327. \beginlist
  328. \item{\kwd{absolute}}
  329. A \term{list} whose \term{car} is the symbol \kwd{absolute} represents
  330. a directory path starting from the root directory. The list
  331. \f{(:absolute)} represents the root directory. The list
  332. \f{(:absolute "foo" "bar" "baz")} represents the directory called
  333. \f{"/foo/bar/baz"} in Unix (except possibly for \term{case}).
  334. \item{\kwd{relative}}
  335. A \term{list} whose \term{car} is the symbol \kwd{relative} represents
  336. a directory path starting from a default directory.
  337. The list \f{(:relative)} has the same meaning as \nil\ and hence is not used.
  338. The list {\tt (:relative "foo" "bar")} represents the directory named {\tt "bar"}
  339. in the directory named {\tt "foo"} in the default directory.
  340. \endlist
  341. Each remaining element of the \term{list} is a \term{string} or a \term{symbol}.
  342. Each \term{string} names a single level of directory structure.
  343. The \term{strings} should contain only the directory names
  344. themselves---no punctuation characters.
  345. In place of a \term{string}, at any point in the \term{list}, \term{symbols}
  346. can occur to indicate special file notations.
  347. \Thenextfigure\ lists the \term{symbols} that have standard meanings.
  348. Implementations are permitted to add additional \term{objects}
  349. of any \term{type} that is disjoint from \typeref{string}
  350. if necessary to represent features of their file systems that cannot be
  351. represented with the standard \term{strings} and \term{symbols}.
  352. Supplying any non-\term{string}, including any of the \term{symbols} listed below,
  353. to a file system for which it does not make sense
  354. signals an error \oftype{file-error}.
  355. For example, Unix does not support \kwd{wild-inferiors} in most implementations.
  356. \idxkwd{wild}\idxkwd{wild-inferiors}\idxkwd{up}\idxkwd{back}%
  357. \tablefigtwo{Special Markers In Directory Component}{Symbol}{Meaning}{
  358. \kwd{wild} & Wildcard match of one level of directory structure \cr
  359. \kwd{wild-inferiors} & Wildcard match of any number of directory levels \cr
  360. \kwd{up} & Go upward in directory structure (semantic) \cr
  361. \kwd{back} & Go upward in directory structure (syntactic) \cr
  362. }
  363. The following notes apply to the previous figure:
  364. \beginlist
  365. \item{Invalid Combinations}
  366. Using \kwd{absolute} or \kwd{wild-inferiors}
  367. immediately followed by \kwd{up} or \kwd{back}
  368. signals an error \oftype{file-error}.
  369. \item{Syntactic vs Semantic}
  370. ``Syntactic'' means that the action of \kwd{back}
  371. depends only on the \term{pathname}
  372. and not on the contents of the file system.
  373. ``Semantic'' means that the action of \kwd{up}
  374. depends on the contents of the file system;
  375. to resolve a \term{pathname} containing
  376. \kwd{up} to a \term{pathname} whose directory component
  377. contains only \kwd{absolute} and
  378. \term{strings} requires probing the file system.
  379. \kwd{up} differs from
  380. \kwd{back} only in file systems that support multiple
  381. names for directories, perhaps via symbolic links. For example,
  382. suppose that there is a directory
  383. \f{(:absolute "X" "Y" "Z")}
  384. linked to
  385. \f{(:absolute "A" "B" "C")}
  386. and there also exist directories
  387. \f{(:absolute "A" "B" "Q")} and
  388. \f{(:absolute "X" "Y" "Q")}.
  389. Then
  390. \f{(:absolute "X" "Y" "Z" :up "Q")}
  391. designates
  392. \f{(:absolute "A" "B" "Q")}
  393. while
  394. \f{(:absolute "X" "Y" "Z" :back "Q")}
  395. designates
  396. \f{(:absolute "X" "Y" "Q")}
  397. \endlist
  398. \endissue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION}
  399. \beginsubsubsubsubsection{Directory Components in Non-Hierarchical File Systems}
  400. In non-hierarchical \term{file systems},
  401. the only valid \term{list} values for the directory component of a \term{pathname}
  402. are \f{(:absolute \term{string})} and \f{(:absolute :wild)}.
  403. \kwd{relative} directories and the keywords
  404. \kwd{wild-inferiors}, \kwd{up}, and \kwd{back} are not used
  405. in non-hierarchical \term{file systems}.
  406. \endsubsubsubsubsection%{Directory Components in Non-Hierarchical File Systems}
  407. \endsubsubsubsection%{Restrictions on Examining a Pathname Directory Component}
  408. \beginsubsubsubsection{Restrictions on Examining a Pathname Name Component}
  409. %% From bullet 3 of ``Restrictions on Examining Pathname Components''
  410. %% the way it used to be arranged.
  411. The name might be a \term{string},
  412. %% These came from other sections earlier -kmp 30-Aug-93
  413. \kwd{wild}, \kwd{unspecific}, or \nil.
  414. \endsubsubsubsection%{Restrictions on Examining a Pathname Name Component}
  415. \beginsubsubsubsection{Restrictions on Examining a Pathname Type Component}
  416. %% From bullet 3 of ``Restrictions on Examining Pathname Components''
  417. %% the way it used to be arranged.
  418. The type might be a \term{string},
  419. %% These came from other sections earlier -kmp 30-Aug-93
  420. \kwd{wild}, \kwd{unspecific}, or \nil.
  421. \endsubsubsubsection%{Restrictions on Examining a Pathname Type Component}
  422. \beginsubsubsubsection{Restrictions on Examining a Pathname Version Component}
  423. The version can be any \term{symbol} or any \term{integer}.
  424. The symbol \kwd{newest} refers to the largest version number
  425. that already exists in the \term{file system}
  426. when reading, overwriting, appending, superseding, or directory listing
  427. an existing \term{file}.
  428. The symbol \kwd{newest} refers to the smallest version number
  429. greater than any existing version number when creating a new file.
  430. The symbols \nil, \kwd{unspecific}, and \kwd{wild} have special meanings and
  431. restrictions; \seesection\SpecialComponentValues\ and \secref\ConstructingPathnames.
  432. Other \term{symbols} and \term{integers}
  433. have \term{implementation-defined} meaning.
  434. \beginsubsubsubsection{Notes about the Pathname Version Component}
  435. It is suggested, but not required, that implementations do the following:
  436. \beginlist
  437. \itemitem{\bull} Use positive \term{integers} starting at 1 as version numbers.
  438. \itemitem{\bull} Recognize the symbol \kwd{oldest}
  439. to designate the smallest existing version number.
  440. \itemitem{\bull} Use \term{keywords} for other special versions.
  441. \endlist
  442. \endsubsubsubsection%{Notes about the Pathname Version Component}
  443. \beginsubsubsection{Restrictions on Constructing Pathnames}
  444. \DefineSection{ConstructingPathnames}
  445. When constructing a \term{pathname} from components, conforming programs
  446. must follow these rules:
  447. \beginlist
  448. \itemitem{\bull}
  449. Any component can be \nil.
  450. \nil\ in the host might mean a default host
  451. rather than an actual \nil\ in some implementations.
  452. \itemitem{\bull}
  453. %!!! Laddaga questions the "directory" part here.
  454. The host, device, directory, name, and type can be \term{strings}. There
  455. are \term{implementation-dependent} limits on the number and type of
  456. \term{characters} in these \term{strings}.
  457. \itemitem{\bull}
  458. The directory can be a \term{list} of \term{strings} and \term{symbols}.
  459. There are \term{implementation-dependent} limits on the \term{list}'s
  460. length and contents.
  461. \itemitem{\bull}
  462. The version can be \kwd{newest}.
  463. \itemitem{\bull}
  464. Any component can be taken
  465. from the corresponding component of another \term{pathname}.
  466. When the two \term{pathnames} are for different file systems
  467. (in implementations that support multiple file systems),
  468. an appropriate translation occurs.
  469. If no meaningful translation is possible,
  470. an error is signaled.
  471. The definitions of ``appropriate'' and ``meaningful''
  472. are \term{implementation-dependent}.
  473. \itemitem{\bull}
  474. An implementation might support other values for some components,
  475. but a portable program cannot use those values.
  476. A conforming program can use \term{implementation-dependent} values
  477. but this can make it non-portable;
  478. for example, it might work only with \Unix\ file systems.
  479. \endlist
  480. %%% 23.1.1 14 omitted.
  481. %%% 23.1.1 18 omitted.
  482. \endsubsubsection%{Restrictions on Constructing Pathnames}
  483. \endissue{PATHNAME-COMPONENT-VALUE:SPECIFY}
  484. \endSubsection%{Interpreting Pathname Component Values}
  485. \beginsubSection{Merging Pathnames}
  486. \DefineSection{MergingPathnames}
  487. Merging takes a \term{pathname} with unfilled components
  488. and supplies values for those components from a source of defaults.
  489. If a component's value is \nil, that component is considered to be unfilled.
  490. If a component's value is any \term{non-nil} \term{object},
  491. including \kwd{unspecific}, that component is considered to be filled.
  492. %% Replaced per X3J13
  493. % %% Moved from ``Restrictions on Examining Pathname Components''
  494. % %% Laddaga had complained that this was in the wrong place before.
  495. % %% This place may not be 100% better, but it's at least an improvement. -kmp 30-Aug-93
  496. % A relative directory in the \term{pathname} argument to a function such as
  497. % \funref{open} is merged with \varref{*default-pathname-defaults*}
  498. % before accessing the file system.
  499. Except as explicitly specified otherwise,
  500. for functions that manipulate or inquire about \term{files} in the \term{file system},
  501. the pathname argument to such a function
  502. is merged with \funref{*default-pathname-defaults*} before accessing the \term{file system}
  503. (as if by \funref{merge-pathnames}).
  504. \beginsubsubsection{Examples of Merging Pathnames}
  505. Although the following examples are possible to execute only in
  506. \term{implementations} which permit \kwd{unspecific} in the indicated
  507. position andwhich permit four-letter type components, they serve to illustrate
  508. the basic concept of \term{pathname} merging.
  509. \medbreak
  510. \code
  511. (pathname-type
  512. (merge-pathnames (make-pathname :type "LISP")
  513. (make-pathname :type "TEXT")))
  514. \EV "LISP"
  515. \smallbreak
  516. (pathname-type
  517. (merge-pathnames (make-pathname :type nil)
  518. (make-pathname :type "LISP")))
  519. \EV "LISP"
  520. \smallbreak
  521. (pathname-type
  522. (merge-pathnames (make-pathname :type :unspecific)
  523. (make-pathname :type "LISP")))
  524. \EV :UNSPECIFIC
  525. \endcode
  526. \endsubsubsection%{Examples of Merging Pathnames}
  527. \endsubSection%{Merging Pathnames}