dict-files.tex 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. % -*- Mode: TeX -*-
  2. % Files
  3. % Directory
  4. % Directory Query
  5. % File Properties
  6. % Directory Modification
  7. %-------------------- Directory Query --------------------
  8. %%% ========== DIRECTORY
  9. \begincom{directory}\ftype{Function}
  10. %% 23.5.0 3
  11. \label Syntax::
  12. \DefunWithValues directory {pathspec {\key}} {pathnames}
  13. \label Arguments and Values::
  14. \issue{PATHNAME-LOGICAL:ADD}
  15. \param{pathspec}---a \term{pathname designator},
  16. which may contain \term{wild} components.
  17. \endissue{PATHNAME-LOGICAL:ADD}
  18. \param{pathnames}---a \term{list} of
  19. \issue{PATHNAME-LOGICAL:ADD}
  20. \term{physical pathnames}.
  21. \endissue{PATHNAME-LOGICAL:ADD}
  22. \label Description::
  23. %% 23.5.0 4
  24. Determines which, if any, \term{files} that are present
  25. in the file system have names matching \param{pathspec},
  26. and returns a
  27. \issue{RESULT-LISTS-SHARED:SPECIFY}
  28. \term{fresh}
  29. \endissue{RESULT-LISTS-SHARED:SPECIFY}
  30. \term{list} of \term{pathnames} corresponding to the \term{truenames} of
  31. those \term{files}.
  32. An \term{implementation} may be extended to accept
  33. \term{implementation-defined} keyword arguments to \funref{directory}.
  34. \label Examples:\None.
  35. \label Affected By::
  36. The host computer's file system.
  37. \label Exceptional Situations::
  38. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  39. If the attempt to obtain a directory listing is not successful,
  40. an error \oftype{file-error} is signaled.
  41. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  42. \label See Also::
  43. \typeref{pathname},
  44. \issue{PATHNAME-LOGICAL:ADD}
  45. \typeref{logical-pathname},
  46. \endissue{PATHNAME-LOGICAL:ADD}
  47. \funref{ensure-directories-exist},
  48. {\secref\FileSystemConcepts},
  49. {\secref\OpenAndClosedStreams},
  50. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  51. {\secref\PathnamesAsFilenames}
  52. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  53. \label Notes::
  54. If the \param{pathspec} is not \term{wild},
  55. the resulting list will contain either zero or one elements.
  56. \clisp\ specifies ``{\key}'' in the argument list to \funref{directory}
  57. even though no \term{standardized} keyword arguments to \funref{directory} are defined.
  58. ``\f{:allow-other-keys t}''
  59. may be used in \term{conforming programs} in order to quietly ignore any
  60. additional keywords which are passed by the program but not supported
  61. by the \term{implementation}.
  62. \endcom
  63. %%% ========== PROBE-FILE
  64. \begincom{probe-file}\ftype{Function}
  65. \label Syntax::
  66. \DefunWithValues probe-file {pathspec} {truename}
  67. \label Arguments and Values::
  68. \issue{PATHNAME-LOGICAL:ADD}
  69. \param{pathspec}---a \term{pathname designator}.
  70. \endissue{PATHNAME-LOGICAL:ADD}
  71. \issue{PATHNAME-LOGICAL:ADD}
  72. \param{truename}---a \term{physical pathname} or \nil.
  73. \endissue{PATHNAME-LOGICAL:ADD}
  74. \label Description::
  75. \funref{probe-file} tests whether a file exists.
  76. %% 23.3.0 12
  77. \funref{probe-file} returns \term{false} if there is no file named \param{pathspec},
  78. and otherwise returns the \term{truename} of \param{pathspec}.
  79. If the \param{pathspec} \term{designator} is an open \term{stream},
  80. then \funref{probe-file} produces the \term{truename} of its associated \term{file}.
  81. %!!! Sandra wonders if the following is implied by "pathname designator":
  82. \issue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY}
  83. If \param{pathspec} is a \term{stream}, whether open or closed,
  84. it is coerced to a \term{pathname} as if by \thefunction{pathname}.
  85. \endissue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY}
  86. \label Examples:\None.
  87. \label Affected By::
  88. The host computer's file system.
  89. \label Exceptional Situations::
  90. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  91. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  92. An error \oftype{file-error} is signaled if \param{pathspec} is \term{wild}.
  93. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  94. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  95. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  96. %% Wording changed per x3j13 (05-Oct-93) -kmp
  97. % If the probe attempt is not successful,
  98. % an error \oftype{file-error} is signaled.
  99. An error \oftype{file-error} is signaled
  100. if the \term{file system} cannot perform the requested operation.
  101. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  102. \label See Also::
  103. \funref{truename},
  104. \funref{open},
  105. \funref{ensure-directories-exist},
  106. \typeref{pathname},
  107. \issue{PATHNAME-LOGICAL:ADD}
  108. \typeref{logical-pathname},
  109. \endissue{PATHNAME-LOGICAL:ADD}
  110. {\secref\FileSystemConcepts},
  111. {\secref\OpenAndClosedStreams},
  112. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  113. {\secref\PathnamesAsFilenames}
  114. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  115. \label Notes:\None.
  116. \endcom
  117. %%% ========== ENSURE-DIRECTORIES-EXIST
  118. \begincom{ensure-directories-exist}\ftype{Function}
  119. \label Syntax::
  120. \DefunWithValues ensure-directories-exist {pathspec {\key} verbose} {pathspec, created}
  121. \label Arguments and Values::
  122. \param{pathspec}---a \term{pathname designator}.
  123. \param{verbose}---a \term{generalized boolean}.
  124. \param{created}---a \term{generalized boolean}.
  125. \label Description::
  126. Tests whether the directories containing the specified \term{file} actually exist,
  127. and attempts to create them if they do not.
  128. If the containing directories do not exist and if \param{verbose} is \term{true},
  129. then the \term{implementation} is permitted (but not required)
  130. to perform output to \term{standard output} saying what directories were created.
  131. If the containing directories exist, or if \param{verbose} is \term{false},
  132. this function performs no output.
  133. The \term{primary value} is the given \term{pathspec} so that this operation can
  134. be straightforwardly composed with other file manipulation expressions.
  135. The \term{secondary value}, \param{created}, is \term{true} if any directories were
  136. created.
  137. \label Examples:\None.
  138. \label Affected By::
  139. The host computer's file system.
  140. \label Exceptional Situations::
  141. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  142. %% Confusion over type of error signaled resolved by x3j13 05-Oct-93
  143. %% (type-error => file-error). -kmp
  144. An error \oftype{file-error} is signaled if the host, device, or directory
  145. part of \param{pathspec} is \term{wild}.
  146. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  147. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  148. If the directory creation attempt is not successful,
  149. an error \oftype{file-error} is signaled;
  150. if this occurs,
  151. it might be the case that none, some, or all
  152. of the requested creations have actually occurred
  153. within the \term{file system}.
  154. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  155. %% Removed per X3J13 05-Oct-93.
  156. %% See first paragraph of Exceptional Situations above. -kmp
  157. % \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  158. % An error \oftype{file-error} might be signaled if \param{pathspec}
  159. % is a \term{designator} for a \term{wild} \term{pathname}.
  160. % \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  161. \label See Also::
  162. \funref{probe-file},
  163. \funref{open},
  164. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  165. {\secref\PathnamesAsFilenames}
  166. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  167. \label Notes:\None.
  168. \endcom
  169. %%% ========== TRUENAME
  170. \begincom{truename}\ftype{Function}
  171. \label Syntax::
  172. \DefunWithValues truename {filespec} {truename}
  173. \label Arguments and Values::
  174. \issue{PATHNAME-LOGICAL:ADD}
  175. \param{filespec}---a \term{pathname designator}.
  176. \endissue{PATHNAME-LOGICAL:ADD}
  177. \issue{PATHNAME-LOGICAL:ADD}
  178. \param{truename}---a \term{physical pathname}.
  179. \endissue{PATHNAME-LOGICAL:ADD}
  180. \label Description::
  181. \funref{truename} tries to find the \term{file} indicated by
  182. \param{filespec} and returns its \term{truename}.
  183. %!!! Sandra wonders if the following is implied by "pathname designator":
  184. %% 23.1.2 6
  185. If the \param{filespec} \term{designator} is an open \term{stream},
  186. its associated \term{file} is used.
  187. \issue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY}
  188. If \param{filespec} is a \term{stream},
  189. \funref{truename} can be used whether the \term{stream}
  190. is open or closed. It is permissible for \funref{truename}
  191. to return more specific information after the \term{stream}
  192. is closed than when the \term{stream} was open.
  193. \endissue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY}
  194. If \param{filespec} is a \term{pathname}
  195. it represents the name used to open the file. This may be, but is
  196. not required to be, the actual name of the file.
  197. \label Examples::
  198. \code
  199. ;; An example involving version numbers. Note that the precise nature of
  200. ;; the truename is implementation-dependent while the file is still open.
  201. (with-open-file (stream ">vistor>test.text.newest")
  202. (values (pathname stream)
  203. (truename stream)))
  204. \EV #P"S:>vistor>test.text.newest", #P"S:>vistor>test.text.1"
  205. \OV #P"S:>vistor>test.text.newest", #P"S:>vistor>test.text.newest"
  206. \OV #P"S:>vistor>test.text.newest", #P"S:>vistor>_temp_._temp_.1"
  207. ;; In this case, the file is closed when the truename is tried, so the
  208. ;; truename information is reliable.
  209. (with-open-file (stream ">vistor>test.text.newest")
  210. (close stream)
  211. (values (pathname stream)
  212. (truename stream)))
  213. \EV #P"S:>vistor>test.text.newest", #P"S:>vistor>test.text.1"
  214. ;; An example involving TOP-20's implementation-dependent concept
  215. ;; of logical devices -- in this case, "DOC:" is shorthand for
  216. ;; "PS:<DOCUMENTATION>" ...
  217. (with-open-file (stream "CMUC::DOC:DUMPER.HLP")
  218. (values (pathname stream)
  219. (truename stream)))
  220. \EV #P"CMUC::DOC:DUMPER.HLP", #P"CMUC::PS:<DOCUMENTATION>DUMPER.HLP.13"
  221. \endcode
  222. \label Affected By:\None.
  223. \label Exceptional Situations::
  224. An error \oftype{file-error} is signaled if an appropriate \term{file}
  225. cannot be located within the \term{file system} for the given \param{filespec},
  226. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  227. %% Additional constraint per x3j13 (05-Oct-93) -kmp
  228. or if the \term{file system} cannot perform the requested operation.
  229. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  230. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  231. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  232. An error \oftype{file-error} is signaled if \param{pathname} is \term{wild}.
  233. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  234. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  235. \label See Also::
  236. \issue{PATHNAME-LOGICAL:ADD}
  237. \typeref{pathname},
  238. \typeref{logical-pathname},
  239. {\secref\FileSystemConcepts},
  240. \endissue{PATHNAME-LOGICAL:ADD}
  241. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  242. {\secref\PathnamesAsFilenames}
  243. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  244. \label Notes::
  245. %% 23.1.2 7
  246. \funref{truename} may be used to account for any \term{filename} translations
  247. performed by the \term{file system}.
  248. \endcom
  249. %-------------------- File Properties --------------------
  250. %%% ========== FILE-AUTHOR
  251. \begincom{file-author}\ftype{Function}
  252. \label Syntax::
  253. \DefunWithValues file-author {pathspec} {author}
  254. \label Arguments and Values::
  255. \issue{PATHNAME-LOGICAL:ADD}
  256. \param{pathspec}---a \term{pathname designator}.
  257. \endissue{PATHNAME-LOGICAL:ADD}
  258. \param{author}---a \term{string} or \nil.
  259. \label Description::
  260. %% 23.3.0 15
  261. Returns a \term{string} naming the author of the \term{file} specified by \param{pathspec},
  262. or \nil\ if the author's name cannot be determined.
  263. \label Examples::
  264. \code
  265. (with-open-file (stream ">relativity>general.text")
  266. (file-author s))
  267. \EV "albert"
  268. \endcode
  269. \label Affected By::
  270. The host computer's file system.
  271. Other users of the \term{file} named by \param{pathspec}.
  272. \label Exceptional Situations::
  273. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  274. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  275. An error \oftype{file-error} is signaled if \param{pathspec} is \term{wild}.
  276. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  277. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  278. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  279. %% Wording changed per x3j13 (05-Oct-93) -kmp
  280. % If the attempt to obtain authorship information is not successful,
  281. % an error \oftype{file-error} is signaled.
  282. An error \oftype{file-error} is signaled
  283. if the \term{file system} cannot perform the requested operation.
  284. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  285. \label See Also::
  286. \issue{PATHNAME-LOGICAL:ADD}
  287. \typeref{pathname},
  288. \typeref{logical-pathname},
  289. {\secref\FileSystemConcepts},
  290. \endissue{PATHNAME-LOGICAL:ADD}
  291. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  292. {\secref\PathnamesAsFilenames}
  293. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  294. \label Notes:\None.
  295. \endcom
  296. %%% ========== FILE-WRITE-DATE
  297. \begincom{file-write-date}\ftype{Function}
  298. \label Syntax::
  299. \DefunWithValues file-write-date {pathspec} {date}
  300. \label Arguments and Values::
  301. \issue{PATHNAME-LOGICAL:ADD}
  302. \param{pathspec}---a \term{pathname designator}.
  303. \endissue{PATHNAME-LOGICAL:ADD}
  304. \param{date}---a \term{universal time} or \nil.
  305. \label Description::
  306. %% 23.3.0 14
  307. Returns a \term{universal time} representing the time at which the \term{file}
  308. specified by \param{pathspec} was last written (or created),
  309. or returns \nil\ if such a time cannot be determined.
  310. \label Examples::
  311. \code
  312. (with-open-file (s "noel.text"
  313. :direction :output :if-exists :error)
  314. (format s "~&Dear Santa,~2%I was good this year. ~
  315. Please leave lots of toys.~2%Love, Sue~
  316. ~2%attachments: milk, cookies~%")
  317. (truename s))
  318. \EV #P"CUPID:/susan/noel.text"
  319. (with-open-file (s "noel.text")
  320. (file-write-date s))
  321. \EV 2902600800
  322. \endcode
  323. \label Affected By::
  324. The host computer's file system.
  325. \label Exceptional Situations::
  326. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  327. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  328. An error \oftype{file-error} is signaled if \param{pathspec} is \term{wild}.
  329. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  330. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  331. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  332. %% Wording changed per x3j13 (05-Oct-93) -kmp
  333. % If the attempt to obtain write-date information is not successful,
  334. % an error \oftype{file-error} is signaled.
  335. An error \oftype{file-error} is signaled
  336. if the \term{file system} cannot perform the requested operation.
  337. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  338. \label See Also::
  339. {\secref\UniversalTime},
  340. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  341. {\secref\PathnamesAsFilenames}
  342. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  343. \label Notes:\None.
  344. \endcom
  345. %-------------------- Directory Modification --------------------
  346. %%% ========== RENAME-FILE
  347. \begincom{rename-file}\ftype{Function}
  348. \label Syntax::
  349. \DefunWithValues rename-file
  350. {filespec new-name}
  351. {defaulted-new-name, old-truename, new-truename}
  352. \label Arguments and Values::
  353. \issue{PATHNAME-LOGICAL:ADD}
  354. \param{filespec}---a \term{pathname designator}.
  355. \endissue{PATHNAME-LOGICAL:ADD}
  356. \param{new-name}---a \term{pathname designator}
  357. %!!! it used to say (or pathname string symbol), so I added this for now ... ??
  358. other than a \term{stream}.
  359. \param{defaulted-new-name}---a \term{pathname}
  360. \param{old-truename}---a \term{physical pathname}.
  361. \param{new-truename}---a \term{physical pathname}.
  362. \label Description::
  363. %% 23.3.0 3
  364. \funref{rename-file} modifies the file system in such a way
  365. that the file indicated by \param{filespec} is renamed to
  366. %% Per X3J13. -kmp 05-Oct-93
  367. %\param{new-name}.
  368. \param{defaulted-new-name}.
  369. %% 23.3.0 6
  370. %!!! Sandra asks whether this first is a prohition on "filespec" or "new-name" or both?
  371. It is an error to specify a filename containing a \term{wild} component,
  372. for \param{filespec} to contain a \nil\ component where the file system does
  373. not permit a \nil\ component, or for the result of defaulting missing
  374. components of \param{new-name} from \param{filespec} to contain a \nil\ component
  375. where the file system does not permit a \nil\ component.
  376. \issue{PATHNAME-LOGICAL:ADD}
  377. If \param{new-name} is a \term{logical pathname},
  378. \funref{rename-file} returns a \term{logical pathname} as its \term{primary value}.
  379. \endissue{PATHNAME-LOGICAL:ADD}
  380. %% 23.3.0 4
  381. \funref{rename-file}
  382. returns three values if successful. The \term{primary value}, \param{defaulted-new-name},
  383. is the resulting name which is composed of
  384. \param{new-name} with any missing components filled in by performing
  385. a \funref{merge-pathnames} operation using \param{filespec} as the defaults.
  386. The \term{secondary value}, \param{old-truename},
  387. is the \term{truename} of the \term{file} before it was renamed.
  388. The \term{tertiary value}, \param{new-truename},
  389. is the \term{truename} of the \term{file} after it was renamed.
  390. If the \param{filespec} \term{designator} is an open \term{stream},
  391. then the \term{stream} itself and the file associated with it are
  392. affected (if the \term{file system} permits).
  393. \label Examples::
  394. \code
  395. ;; An example involving logical pathnames.
  396. (with-open-file (stream "sys:chemistry;lead.text"
  397. :direction :output :if-exists :error)
  398. (princ "eureka" stream)
  399. (values (pathname stream) (truename stream)))
  400. \EV #P"SYS:CHEMISTRY;LEAD.TEXT.NEWEST", #P"Q:>sys>chem>lead.text.1"
  401. (rename-file "sys:chemistry;lead.text" "gold.text")
  402. \EV #P"SYS:CHEMISTRY;GOLD.TEXT.NEWEST",
  403. #P"Q:>sys>chem>lead.text.1",
  404. #P"Q:>sys>chem>gold.text.1"
  405. \endcode
  406. \label Affected By:\None.
  407. \label Exceptional Situations::
  408. %% 23.3.0 5
  409. If the renaming operation is not successful, an error \oftype{file-error} is signaled.
  410. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  411. An error \oftype{file-error} might be signaled if \param{filespec} is \term{wild}.
  412. %!!! Sandra asks whether this should extend to "new-name" as well?
  413. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  414. \label See Also::
  415. \issue{PATHNAME-LOGICAL:ADD}
  416. \funref{truename},
  417. \typeref{pathname},
  418. \typeref{logical-pathname},
  419. {\secref\FileSystemConcepts},
  420. \endissue{PATHNAME-LOGICAL:ADD}
  421. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  422. {\secref\PathnamesAsFilenames}
  423. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  424. \label Notes:\None.
  425. \endcom
  426. %%% ========== DELETE-FILE
  427. \begincom{delete-file}\ftype{Function}
  428. \label Syntax::
  429. \DefunWithValues delete-file {filespec} {\t}
  430. \label Arguments and Values::
  431. \issue{PATHNAME-LOGICAL:ADD}
  432. \param{filespec}---a \term{pathname designator}.
  433. \endissue{PATHNAME-LOGICAL:ADD}
  434. \label Description::
  435. Deletes the \term{file} specified by \param{filespec}.
  436. %!!! Sandra thinks this makes no sense. -kmp 12-Dec-91
  437. If the \param{filespec} \term{designator} is an open \term{stream},
  438. then \param{filespec} and the file associated with it are affected
  439. (if the file system permits),
  440. in which case \param{filespec} might be closed immediately,
  441. and the deletion might be immediate or delayed until \param{filespec} is explicitly closed,
  442. depending on the requirements of the file system.
  443. It is \term{implementation-dependent} whether an attempt
  444. to delete a nonexistent file is considered to be successful.
  445. %% 23.3.0 8
  446. %% 23.3.0 9
  447. \funref{delete-file} returns \term{true} if it succeeds,
  448. or signals an error \oftype{file-error} if it does not.
  449. %% 23.3.0 10
  450. The consequences are undefined
  451. if \param{filespec} has a \term{wild} component,
  452. or if \param{filespec} has a \nil\ component
  453. and the file system does not permit a \nil\ component.
  454. \label Examples::
  455. \code
  456. (with-open-file (s "delete-me.text" :direction :output :if-exists :error))
  457. \EV NIL
  458. (setq p (probe-file "delete-me.text")) \EV #P"R:>fred>delete-me.text.1"
  459. (delete-file p) \EV T
  460. (probe-file "delete-me.text") \EV \term{false}
  461. (with-open-file (s "delete-me.text" :direction :output :if-exists :error)
  462. (delete-file s))
  463. \EV T
  464. (probe-file "delete-me.text") \EV \term{false}
  465. \endcode
  466. \label Affected By:\None.
  467. \label Exceptional Situations::
  468. If the deletion operation is not successful, an error \oftype{file-error} is signaled.
  469. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  470. An error \oftype{file-error} might be signaled if \param{filespec} is \term{wild}.
  471. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  472. \label See Also::
  473. \issue{PATHNAME-LOGICAL:ADD}
  474. \typeref{pathname},
  475. \typeref{logical-pathname},
  476. {\secref\FileSystemConcepts},
  477. \endissue{PATHNAME-LOGICAL:ADD}
  478. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  479. {\secref\PathnamesAsFilenames}
  480. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  481. \label Notes:\None.
  482. \endcom
  483. %-------------------- File Errors --------------------
  484. \begincom{file-error}\ftype{Condition Type}
  485. \label Class Precedence List::
  486. \typeref{file-error},
  487. \typeref{error},
  488. \typeref{serious-condition},
  489. \typeref{condition},
  490. \typeref{t}
  491. \label Description::
  492. \Thetype{file-error} consists of error conditions that occur during
  493. an attempt to open or close a file, or during some low-level transactions
  494. with a file system. The ``offending pathname'' is initialized by
  495. \theinitkeyarg{pathname} to \funref{make-condition}, and is \term{accessed}
  496. by \thefunction{file-error-pathname}.
  497. \label See Also::
  498. \function{file-error-pathname},
  499. \funref{open},
  500. \funref{probe-file},
  501. \funref{directory},
  502. \funref{ensure-directories-exist}
  503. \endcom%{file-error}\ftype{Condition Type}
  504. %%% ========== FILE-ERROR-PATHNAME
  505. \begincom{file-error-pathname}\ftype{Function}
  506. \label Syntax::
  507. \DefunWithValues file-error-pathname {condition} {pathspec}
  508. \label Arguments and Values::
  509. \param{condition}---a \term{condition} \oftype{file-error}.
  510. \param{pathspec}---a \term{pathname designator}.
  511. \label Description::
  512. Returns the ``offending pathname'' of a \term{condition} \oftype{file-error}.
  513. \label Examples:\None.
  514. \label Side Effects:\None.
  515. \label Affected By:\None.
  516. \label Exceptional Situations::
  517. % This might signal an error (probably TYPE-ERROR, but you can't say that
  518. % because it's not been voted in yet) if argument is not of correct type.
  519. % (Part of the issue here is whether anyone might define other signatures.)
  520. \label See Also::
  521. \typeref{file-error},
  522. {\secref\Conditions}
  523. \label Notes:\None.
  524. %% Removed because no primitive is provided to do this! -kmp
  525. %It is an error to use \macref{setf} with \funref{file-error-pathname}.
  526. \endcom