dict-system-construction.tex 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222
  1. % -*- Mode: TeX -*-
  2. % System Construction
  3. % System Construction Variables
  4. %-------------------- System Construction --------------------
  5. %%% ========== COMPILE-FILE
  6. \begincom{compile-file}\ftype{Function}
  7. \label Syntax::
  8. \issue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  9. \DefunWithValuesNewline compile-file
  10. {input-file {\key} \vtop{\hbox{output-file verbose}
  11. \hbox{print external-format}}}
  12. {output-truename, warnings-p, failure-p}
  13. \endissue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  14. \label Arguments and Values::
  15. \param{input-file}---a \term{pathname designator}.
  16. (Default fillers for unspecified components are taken from
  17. \varref{*default-pathname-defaults*}.)
  18. \param{output-file}---a \term{pathname designator}.
  19. \Default{\term{implementation-defined}}
  20. \issue{COMPILER-VERBOSITY:LIKE-LOAD}
  21. \param{verbose}---a \term{generalized boolean}.
  22. \Default{\thevalueof{*compile-verbose*}}
  23. \param{print}---a \term{generalized boolean}.
  24. \Default{\thevalueof{*compile-print*}}
  25. \endissue{COMPILER-VERBOSITY:LIKE-LOAD}
  26. \issue{COMPILER-DIAGNOSTICS:USE-HANDLER}
  27. \issue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  28. \param{external-format}---an \term{external file format designator}.
  29. \Default{\kwd{default}}
  30. \endissue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  31. \param{output-truename}---a \term{pathname} (the \funref{truename} of the output \term{file}),
  32. or \nil.
  33. \param{warnings-p}---a \term{generalized boolean}.
  34. \param{failure-p}---a \term{generalized boolean}.
  35. \endissue{COMPILER-DIAGNOSTICS:USE-HANDLER}
  36. \label Description::
  37. %% 25.1.0 7
  38. \funref{compile-file} transforms the contents of the file specified
  39. by \param{input-file} into \term{implementation-dependent} binary data
  40. which are placed in the file specified by \param{output-file}.
  41. The \term{file} to which \param{input-file} refers should be a \term{source file}.
  42. %% 25.1.0 8
  43. \param{output-file} can be used to specify an output \term{pathname};
  44. \issue{COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE}
  45. the actual \term{pathname} of the \term{compiled file}
  46. to which \term{compiled code} will be output
  47. is computed as if by calling \funref{compile-file-pathname}.
  48. \endissue{COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE}
  49. \issue{PATHNAME-LOGICAL:ADD}
  50. If \param{input-file} or \param{output-file} is a \term{logical pathname},
  51. it is translated into a \term{physical pathname} as if by calling
  52. \funref{translate-logical-pathname}.
  53. \endissue{PATHNAME-LOGICAL:ADD}
  54. % !!! This leading semicolon stuff is stupid. -kmp 25-Jan-92
  55. \issue{COMPILER-VERBOSITY:LIKE-LOAD}
  56. \issue{KMP-COMMENTS-ON-SANDRA-COMMENTS:X3J13-MAR-92}
  57. If \param{verbose} is \term{true},
  58. % \funref{compile-file} prints a message with a leading \term{semicolon} (a comment)
  59. % to \term{standard output} indicating what file is being compiled
  60. \funref{compile-file} prints a message in the form of a comment
  61. (\ie with a leading \term{semicolon})
  62. to \term{standard output} indicating what \term{file} is being \term{compiled}
  63. and other useful information.
  64. If \param{verbose} is \term{false},
  65. \funref{compile-file} does not print
  66. %the informational message.
  67. this information.
  68. \endissue{KMP-COMMENTS-ON-SANDRA-COMMENTS:X3J13-MAR-92}
  69. If \param{print} is \term{true},
  70. information about \term{top level forms} in the file being
  71. compiled is printed to \term{standard output}.
  72. Exactly what is printed is \term{implementation-dependent},
  73. but nevertheless some information is printed.
  74. If \param{print} is \nil, no information is printed.
  75. \endissue{COMPILER-VERBOSITY:LIKE-LOAD}
  76. \issue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  77. The \param{external-format} specifies the \term{external file format}
  78. to be used when opening the \term{file}; \seefun{open}.
  79. \funref{compile-file} and \funref{load} must cooperate in such a way that
  80. the resulting \term{compiled file} can be \term{loaded}
  81. without specifying an \term{external file format} anew; \seefun{load}.
  82. \endissue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  83. %\funref{compile-file} uses \funref{read} to read \term{forms}
  84. %from the input file.
  85. \issue{COMPILE-FILE-PACKAGE}
  86. \issue{IN-SYNTAX:MINIMAL}
  87. \funref{compile-file} binds \varref{*readtable*} and \varref{*package*}
  88. to the values they held before processing the file.
  89. \endissue{IN-SYNTAX:MINIMAL}
  90. \endissue{COMPILE-FILE-PACKAGE}
  91. %!!! Can this be said more compactly or not at all?
  92. \issue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  93. \varref{*compile-file-truename*} is bound by \funref{compile-file}
  94. to hold the \term{truename} of the \term{pathname} of the file being compiled.
  95. \endissue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  96. \issue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  97. \varref{*compile-file-pathname*} is bound by \funref{compile-file}
  98. to hold a \term{pathname} denoted by the first argument to \funref{compile-file},
  99. merged against the defaults;
  100. that is, \f{(pathname (merge-pathnames \param{input-file}))}.
  101. \endissue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  102. The compiled \term{functions} contained in the \term{compiled file} become available
  103. for use when the \term{compiled file} is \term{loaded} into Lisp.
  104. \issue{COMPILED-FUNCTION-REQUIREMENTS:TIGHTEN}
  105. Any function definition that is processed by the
  106. compiler, including \f{\#'(lambda ...)} forms and local function
  107. definitions made by \specref{flet}, \specref{labels} and \macref{defun} forms,
  108. result in an \term{object} \oftype{compiled-function}.
  109. \endissue{COMPILED-FUNCTION-REQUIREMENTS:TIGHTEN}
  110. \issue{COMPILER-DIAGNOSTICS:USE-HANDLER}
  111. The \term{primary value} returned by \funref{compile-file}, \param{output-truename},
  112. is the \funref{truename} of the output file, or \nil\ if the file could not be created.
  113. % I replaced the language that was here with a copy of what is already said
  114. % for COMPILE. --sjl 7 Mar 92
  115. The \term{secondary value}, \param{warnings-p}, is \term{false}
  116. % clarify ``compiler diagnostics'' --sjl 7 Mar 92
  117. %if no compiler diagnostics were issued, and \term{true} otherwise.
  118. if no \term{conditions} \oftype{error} or \typeref{warning}
  119. were detected by the compiler, and \term{true} otherwise.
  120. The \term{tertiary value}, \param{failure-p}, is \term{false}
  121. % clarify ``compiler diagnostics'' --sjl 7 Mar 92
  122. %if no compiler diagnostics other than \term{style warnings} were issued.
  123. %A value of \term{true} indicates that there were serious compiler diagnostics
  124. %issued, or that other \term{conditions} \oftype{error} or \typeref{warning}
  125. %(but not \oftype{style-warning}) were signaled during compilation.
  126. if no \term{conditions} \oftype{error} or \typeref{warning}
  127. (other than \typeref{style-warning})
  128. were detected by the compiler, and \term{true} otherwise.
  129. \endissue{COMPILER-DIAGNOSTICS:USE-HANDLER}
  130. For general information about how \term{files} are processed by the \term{file compiler},
  131. \seesection\FileCompilation.
  132. % This is said below now. --sjl 7 Mar 92
  133. %For a description of signaling and handling of errors by the \term{file compiler},
  134. %\seesection\FileCompilerExceptions.
  135. \issue{LOAD-OBJECTS:MAKE-LOAD-FORM}
  136. \term{Programs} to be compiled by the \term{file compiler} must only contain
  137. \term{externalizable objects}; for details on such \term{objects},
  138. \seesection\LiteralsInCompiledFiles.
  139. For information on how to extend the set of \term{externalizable objects},
  140. \seefun{make-load-form} and \secref\CallingMakeLoadForm.
  141. \endissue{LOAD-OBJECTS:MAKE-LOAD-FORM}
  142. \label Examples:\None.
  143. \label Affected By::
  144. \issue{COMPILER-WARNING-STREAM}
  145. \varref{*error-output*},
  146. \endissue{COMPILER-WARNING-STREAM}
  147. \issue{COMPILER-VERBOSITY:LIKE-LOAD}
  148. \varref{*standard-output*}, \varref{*compile-verbose*}, \varref{*compile-print*}
  149. \endissue{COMPILER-VERBOSITY:LIKE-LOAD}
  150. The computer's file system.
  151. \label Exceptional Situations::
  152. % The following information is mostly redundant with info in the chapter 3
  153. % concept section, and contains some inconsistencies. Better to just
  154. % put in a cross-reference. --sjl 4 mar 92
  155. % \issue{COMPILER-DIAGNOSTICS:USE-HANDLER}
  156. % The following list considers only
  157. % those conditions signaled by, not within, the compiler.
  158. %
  159. % An error \oftype{error} might be signaled by the compiler in situations
  160. % where the compilation cannot proceed without intervention.
  161. % Examples include file open errors and syntax errors.
  162. %
  163. % A condition \oftype{warning} \editornote{KMP: I guess we should
  164. % add ``correctable by muffle-warning''.} might be signaled by the compiler in
  165. % situations where this standard explicitly states that a warning must,
  166. % should, or might be signaled.
  167. % Also, an error \oftype{warning} might be signaled
  168. % by the compiler in situations where the compiler can determine
  169. % that a situation with undefined consequences or that would cause
  170. % an error to be signaled would result at runtime.
  171. % Examples include
  172. % violation of type declarations,
  173. % \term{assigning} or \term{binding} a \term{constant variable},
  174. % calling
  175. % a built-in Lisp function with the wrong number of arguments
  176. % or malformed keyword argument lists,
  177. % referencing a variable declared \declref{ignore}, and
  178. % the usage of unrecognized declaration specifiers.
  179. %
  180. % The compiler is permitted to signal errors \oftype{style-warning}
  181. % about matters of programming style. Although \term{style warnings} might
  182. % be signaled in these situations, no implementation is required to signal them.
  183. % However, if an implementation does choose to signal an condition about matters of
  184. % programming style, that condition is \oftype{style-warning} and is signaled
  185. % by a call to \funref{warn}.
  186. % Examples include redefinition of a \term{function} with a different argument list,
  187. % calling a \term{function} with the wrong number of arguments,
  188. % \term{accessing} unreferenced local variables not declared \declref{ignore}, and
  189. % usage of declaration specifiers described in this standard but ignored by
  190. % the compiler.
  191. %
  192. % \endissue{COMPILER-DIAGNOSTICS:USE-HANDLER}
  193. For information about errors detected during the compilation process,
  194. \seesection\FileCompilerExceptions.
  195. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  196. An error \oftype{file-error} might be signaled if
  197. {\tt (wild-pathname-p \param{input-file})\/} returns true.
  198. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  199. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  200. If either the attempt to open the \term{source file} for input
  201. or the attempt to open the \term{compiled file} for output
  202. fails,
  203. an error \oftype{file-error} is signaled.
  204. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  205. \label See Also::
  206. \issue{PATHNAME-LOGICAL:ADD}
  207. \funref{compile},
  208. \misc{declare},
  209. \specref{eval-when},
  210. \typeref{pathname},
  211. \typeref{logical-pathname},
  212. {\secref\FileSystemConcepts},
  213. \endissue{PATHNAME-LOGICAL:ADD}
  214. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  215. {\secref\PathnamesAsFilenames}
  216. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  217. \label Notes:\None.
  218. \issue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES}
  219. % \issue{PATHNAME-LOGICAL:ADD}
  220. % Whether \funref{compile-file} recognizes \term{logical pathname} \term{namestrings}
  221. % (as opposed to \term{logical pathname} \term{objects})
  222. % is \term{implementation-defined}.
  223. % \endissue{PATHNAME-LOGICAL:ADD}
  224. \endissue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES}
  225. \endcom
  226. %%% ========== COMPILE-FILE-PATHNAME
  227. \begincom{compile-file-pathname}\ftype{Function}
  228. \issue{PATHNAME-LOGICAL:ADD}
  229. \label Syntax::
  230. \issue{COMPILE-FILE-PATHNAME-ARGUMENTS:MAKE-CONSISTENT}
  231. \DefunWithValues compile-file-pathname
  232. {input-file {\key} output-file {\allowotherkeys}}
  233. {pathname}
  234. \endissue{COMPILE-FILE-PATHNAME-ARGUMENTS:MAKE-CONSISTENT}
  235. \label Arguments and Values::
  236. \param{input-file}---a \term{pathname designator}.
  237. (Default fillers for unspecified components are taken from
  238. \varref{*default-pathname-defaults*}.)
  239. \param{output-file}---a \term{pathname designator}.
  240. \Default{\term{implementation-defined}}
  241. \param{pathname}---a \term{pathname}.
  242. \label Description::
  243. Returns the \term{pathname} that \funref{compile-file} would write into,
  244. if given the same arguments.
  245. \issue{COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE}
  246. The defaults for the \param{output-file}
  247. are taken from the \term{pathname}
  248. that results from merging the \param{input-file}
  249. with \thevalueof{*default-pathname-defaults*},
  250. except that the type component
  251. should default to the appropriate
  252. \term{implementation-defined} default type for \term{compiled files}.
  253. \endissue{COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE}
  254. If \param{input-file} is a \term{logical pathname} and \param{output-file}
  255. is unsupplied, the result is a \term{logical pathname}.
  256. \issue{PATHNAME-LOGICAL:ADD}
  257. If \param{input-file} is a \term{logical pathname},
  258. it is translated into a physical pathname as if by calling
  259. \funref{translate-logical-pathname}.
  260. \endissue{PATHNAME-LOGICAL:ADD}
  261. \issue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY}
  262. If \param{input-file} is a \term{stream},
  263. the \term{stream} can be either open or closed.
  264. \funref{compile-file-pathname} returns the same \term{pathname} after a
  265. file is closed as it did when the file was open.
  266. \endissue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY}
  267. \issue{PATHNAME-STREAM}
  268. It is an error if \param{input-file} is a \term{stream} that is
  269. created with \funref{make-two-way-stream}, \funref{make-echo-stream},
  270. \funref{make-broadcast-stream}, \funref{make-concatenated-stream},
  271. \funref{make-string-input-stream}, \funref{make-string-output-stream}.
  272. \endissue{PATHNAME-STREAM}
  273. If an implementation supports additional keyword arguments to \funref{compile-file},
  274. \funref{compile-file-pathname} must accept the same arguments.
  275. \label Examples::
  276. See \funref{logical-pathname-translations}.
  277. \label Affected By:\None.
  278. \label Exceptional Situations::
  279. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  280. An error \oftype{file-error} might be signaled if either \param{input-file} or
  281. \param{output-file} is \term{wild}.
  282. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  283. \label See Also::
  284. \issue{PATHNAME-LOGICAL:ADD}
  285. \funref{compile-file},
  286. \typeref{pathname},
  287. \typeref{logical-pathname},
  288. {\secref\FileSystemConcepts},
  289. \endissue{PATHNAME-LOGICAL:ADD}
  290. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  291. {\secref\PathnamesAsFilenames}
  292. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  293. \label Notes:\None.
  294. \issue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES}
  295. % \issue{PATHNAME-LOGICAL:ADD}
  296. % Whether \funref{compile-file-pathname} recognizes \term{logical pathname} \term{namestrings}
  297. % (as opposed to \term{logical pathname} \term{objects})
  298. % is \term{implementation-defined}.
  299. % \endissue{PATHNAME-LOGICAL:ADD}
  300. \endissue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES}
  301. \endissue{PATHNAME-LOGICAL:ADD}
  302. \endcom
  303. %%% ========== LOAD
  304. \begincom{load}\ftype{Function}
  305. \label Syntax::
  306. \issue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  307. \DefunWithValuesNewline load
  308. {filespec {\key} \vtop{\hbox{verbose print}
  309. \hbox{if-does-not-exist external-format}}}
  310. {generalized-boolean}
  311. \endissue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  312. \label Arguments and Values::
  313. %!!! Need to think about "file designator" here.
  314. \param{filespec}---a \term{stream}, or a \term{pathname designator}.
  315. %% 23.4.0 4
  316. \Default{taken from \varref{*default-pathname-defaults*}}
  317. \param{verbose}---a \term{generalized boolean}.
  318. \Default{\thevalueof{*load-verbose*}}
  319. \param{print}---a \term{generalized boolean}.
  320. \Default{\thevalueof{*load-print*}}
  321. %!!! Looks mighty strange to me! -kmp 26-Jun-93
  322. \param{if-does-not-exist}---a \term{generalized boolean}.
  323. \Default{\term{true}}
  324. \issue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  325. \param{external-format}---an \term{external file format designator}.
  326. \Default{\kwd{default}}
  327. \endissue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  328. \param{generalized-boolean}---a \term{generalized boolean}.
  329. \label Description::
  330. %% 23.4.0 3
  331. \funref{load} \term{loads} the \term{file} named by \param{filespec}
  332. into the \Lisp\ environment.
  333. The manner in which a \term{source file}
  334. is distinguished from a \term{compiled file} is \term{implementation-dependent}.
  335. % If it is not possible to distinguish between a character file and a
  336. % compiled file by \param{filespec},
  337. If the file specification is not complete and both a \term{source file} and a
  338. \term{compiled file} exist which might match,
  339. then which of those files \funref{load} selects is \term{implementation-dependent}.
  340. If \param{filespec} is a \term{stream},
  341. \funref{load} determines what kind of \term{stream} it is
  342. and loads directly from the \term{stream}.
  343. \issue{PATHNAME-LOGICAL:ADD}
  344. If \param{filespec} is a \term{logical pathname},
  345. it is translated into a \term{physical pathname}
  346. as if by calling \funref{translate-logical-pathname}.
  347. \endissue{PATHNAME-LOGICAL:ADD}
  348. \issue{EVAL-TOP-LEVEL:LOAD-LIKE-COMPILE-FILE}
  349. %% Per X3J13 -kmp 5-Oct-93
  350. % \funref{load} evaluates each \term{form} it encounters in the file
  351. % named by \param{filespec}.
  352. \funref{load} sequentially executes each \term{form} it encounters
  353. in the \term{file} named by \param{filespec}.
  354. If the \term{file} is a \term{source file}
  355. and the \term{implementation} chooses to perform \term{implicit compilation},
  356. \funref{load} must recognize \term{top level forms}
  357. as described in {\secref\TopLevelForms}
  358. and arrange for each \term{top level form} to be executed
  359. before beginning \term{implicit compilation} of the next.
  360. (Note, however, that processing of \specref{eval-when} \term{forms}
  361. by \funref{load} is controlled by the \kwd{execute} situation.)
  362. \endissue{EVAL-TOP-LEVEL:LOAD-LIKE-COMPILE-FILE}
  363. \issue{KMP-COMMENTS-ON-SANDRA-COMMENTS:X3J13-MAR-92}
  364. % If \param{verbose} is \term{true},
  365. % \funref{load} prints a message
  366. % %% KMP: This semicolon thing is environment stuff and not proper here.
  367. % %% No portable program can rely on it, so it's stupid to require it.
  368. % %with a leading \term{semicolon} (a comment)
  369. % to \term{standard output} indicating what file is being loaded
  370. % and other useful information.
  371. % %% Changed into a `suggestion' in response to gripe above. -kmp 7-Feb-92
  372. % % I disagree with this change; CLtL doesn't say ``maybe''. Also look
  373. % % at the corresponding parameter for COMPILE-FILE. --sjl 4 Mar 92
  374. % %Such information might be preceded by a leading \term{semicolon} (\eg as in a comment).
  375. % Such information is preceded by a leading \term{semicolon} (\eg as in a comment).
  376. If \param{verbose} is \term{true},
  377. \funref{load} prints a message in the form of a comment
  378. (\ie with a leading \term{semicolon})
  379. to \term{standard output} indicating what \term{file} is being \term{loaded}
  380. and other useful information.
  381. \endissue{KMP-COMMENTS-ON-SANDRA-COMMENTS:X3J13-MAR-92}
  382. %% 23.4.0 5
  383. If \param{verbose} is \term{false},
  384. \funref{load} does not print this information.
  385. %% Barmar and I puzzled over this for a while and decided that it was best not to
  386. %% be overly constraining to implementations, since absolute conformance is hard to
  387. %% do in general if you're too strict. We softened the wording just slightly.
  388. %% -kmp 7-Feb-92
  389. If \param{print} is \term{true},
  390. \funref{load} incrementally prints information to \term{standard output}
  391. showing the progress of the \term{loading} process.
  392. For a \term{source file},
  393. this information might mean printing the \term{values}
  394. \term{yielded} by each \term{form} in the \term{file}
  395. as soon as those \term{values} are returned.
  396. For a \term{compiled file},
  397. what is printed might not reflect precisely the contents of the \term{source file},
  398. but some information is generally printed.
  399. If \param{print} is \term{false},
  400. \funref{load} does not print this information.
  401. %% 23.4.0 6
  402. %% 23.4.0 7
  403. If the file named by \param{filespec} is successfully loaded,
  404. \funref{load} returns \term{true}.
  405. %%!!! Removed for now because Sandra's comment below make it clear
  406. %% that this is confusing and wrong. -kmp 3-Dec-91
  407. %otherwise, \nil\ is returned or an error is
  408. %signaled, depending upon the value of \param{if-does-not-exist}.
  409. \reviewer{Loosemore: What happens if the file cannot be loaded for some reason other
  410. than that it doesn't exist?} \editornote{KMP: i.e., can it return NIL? must it?}
  411. If the file does not exist,
  412. the specific action taken depends on \param{if-does-not-exist}:
  413. if it is \nil, \funref{load} returns \nil;
  414. otherwise, \funref{load} signals an error.
  415. \issue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  416. The \param{external-format} specifies the \term{external file format}
  417. to be used when opening the \term{file} (\seefun{open}),
  418. except that when the \term{file} named by \param{filespec} is a \term{compiled file},
  419. the \param{external-format} is ignored.
  420. \funref{compile-file} and \funref{load} cooperate
  421. in an \term{implementation-dependent} way to assure
  422. the preservation of the \term{similarity} of \term{characters}
  423. referred to in the \term{source file}
  424. at the time the \term{source file} was processed by the \term{file compiler}
  425. under a given \term{external file format},
  426. regardless of the value of \param{external-format}
  427. at the time the \term{compiled file} is \term{loaded}.
  428. \endissue{EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM}
  429. %% 11.2.0 7
  430. \issue{IN-SYNTAX:MINIMAL}
  431. \funref{load} binds \varref{*readtable*} and \varref{*package*}
  432. to the values they held before \term{loading} the file.
  433. \endissue{IN-SYNTAX:MINIMAL}
  434. \issue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  435. \varref{*load-truename*} is \term{bound} by \funref{load} to hold
  436. the \term{truename} of the \term{pathname} of the file being \term{loaded}.
  437. \varref{*load-pathname*} is \term{bound} by \funref{load} to hold
  438. a \term{pathname} that represents \param{filespec} merged against the defaults.
  439. That is, {\tt (pathname (merge-pathnames \param{filespec}))}.
  440. \endissue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  441. \label Examples::
  442. \code
  443. ;Establish a data file...
  444. (with-open-file (str "data.in" :direction :output :if-exists :error)
  445. (print 1 str) (print '(setq a 888) str) t)
  446. \EV T
  447. (load "data.in") \EV \term{true}
  448. a \EV 888
  449. (load (setq p (merge-pathnames "data.in")) :verbose t)
  450. ; Loading contents of file /fred/data.in
  451. ; Finished loading /fred/data.in
  452. \EV \term{true}
  453. (load p :print t)
  454. ; Loading contents of file /fred/data.in
  455. ; 1
  456. ; 888
  457. ; Finished loading /fred/data.in
  458. \EV \term{true}
  459. \endcode
  460. \medbreak
  461. \issue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  462. \code
  463. ;----[Begin file SETUP]----
  464. (in-package "MY-STUFF")
  465. (defmacro compile-truename () `',*compile-file-truename*)
  466. (defvar *my-compile-truename* (compile-truename) "Just for debugging.")
  467. (defvar *my-load-pathname* *load-pathname*)
  468. (defun load-my-system ()
  469. (dolist (module-name '("FOO" "BAR" "BAZ"))
  470. (load (merge-pathnames module-name *my-load-pathname*))))
  471. ;----[End of file SETUP]----
  472. (load "SETUP")
  473. (load-my-system)
  474. \endcode
  475. \endissue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  476. \label Affected By::
  477. The implementation, and the host computer's file system.
  478. \label Exceptional Situations::
  479. If \kwd{if-does-not-exist} is supplied and is \term{true}, or is not supplied,
  480. \funref{load} signals an error \oftype{file-error} if the file named by
  481. \param{filespec} does not exist,
  482. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  483. %% Additional constraint per x3j13 (05-Oct-93) -kmp
  484. or if the \term{file system} cannot perform the requested operation.
  485. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  486. \issue{PATHNAME-WILD:NEW-FUNCTIONS}
  487. An error \oftype{file-error} might be signaled if
  488. \f{(wild-pathname-p \param{filespec})} returns \term{true}.
  489. \endissue{PATHNAME-WILD:NEW-FUNCTIONS}
  490. \label See Also::
  491. \issue{PATHNAME-LOGICAL:ADD}
  492. \funref{error},
  493. \funref{merge-pathnames},
  494. \varref{*load-verbose*},
  495. \varref{*default-pathname-defaults*},
  496. \typeref{pathname},
  497. \typeref{logical-pathname},
  498. {\secref\FileSystemConcepts},
  499. \endissue{PATHNAME-LOGICAL:ADD}
  500. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  501. {\secref\PathnamesAsFilenames}
  502. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  503. \label Notes:\None.
  504. \issue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES}
  505. % \issue{PATHNAME-LOGICAL:ADD}
  506. % Whether \funref{load} recognizes \term{logical pathname} \term{namestrings}
  507. % (as opposed to \term{logical pathname} \term{objects})
  508. % is \term{implementation-defined}.
  509. % \endissue{PATHNAME-LOGICAL:ADD}
  510. \endissue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES}
  511. \endcom
  512. %%% ========== WITH-COMPILATION-UNIT
  513. \begincom{with-compilation-unit}\ftype{Macro}
  514. \issue{WITH-COMPILATION-UNIT:NEW-MACRO}
  515. \label Syntax::
  516. \DefmacWithValues with-compilation-unit
  517. {\paren{\interleave{\down{option}}}
  518. \starparam{form}}
  519. {\starparam{result}}
  520. \auxbnf{option}{\kwd{override} override}
  521. \label Arguments and Values::
  522. \param{override}---a \term{generalized boolean}; \eval.
  523. \Default{\nil}
  524. \param{forms}---an \term{implicit progn}.
  525. \param{results}---the \term{values} returned by the \term{forms}.
  526. %!!! This description needs work. -kmp 29-Jul-91
  527. \label Description::
  528. Executes \param{forms} from left to right.
  529. Within the \term{dynamic environment} of \macref{with-compilation-unit},
  530. actions deferred by the compiler until the end of compilation will be
  531. deferred until the end of the outermost call to \macref{with-compilation-unit}.
  532. The set of \term{options} permitted may be extended by the implementation,
  533. but the only \term{standardized} keyword is \kwd{override}.
  534. If nested dynamically only the outer call to
  535. \macref{with-compilation-unit} has any effect unless the value
  536. associated with \kwd{override} is \term{true}, in which case warnings are
  537. deferred only to the end of the innermost call for which \param{override} is \term{true}.
  538. % This was incorrectly transcribed from the cleanup issue. --sjl 4 mar 92
  539. %The functions \funref{compile} and \term{compile-file}
  540. The function \funref{compile-file}
  541. provides the effect of
  542. \code
  543. (with-compilation-unit (:override nil) ...)
  544. \endcode
  545. around its \term{code}.
  546. Any \term{implementation-dependent} extensions can only be provided as the
  547. result of an explicit programmer request by use of an
  548. \term{implementation-dependent} keyword. \term{Implementations} are forbidden
  549. from attaching additional meaning to a use of this macro which involves either
  550. no keywords or just the keyword \kwd{override}.
  551. \label Examples::
  552. If an \term{implementation} would normally defer certain kinds of warnings,
  553. such as warnings about undefined functions, to the end of a compilation
  554. unit (such as a \term{file}), the following example shows how to cause those
  555. warnings to be deferred to the end of the compilation of several files.
  556. \code
  557. (defun compile-files (&rest files)
  558. (with-compilation-unit ()
  559. (mapcar #'(lambda (file) (compile-file file)) files)))
  560. (compile-files "A" "B" "C")
  561. \endcode
  562. Note however that if the implementation does not normally defer any warnings,
  563. use of \term{with-compilation-unit} might not have any effect.
  564. \label Affected By:\None.
  565. \label Exceptional Situations:\None.
  566. \label See Also::
  567. \funref{compile}, \funref{compile-file}
  568. \label Notes:\None.
  569. \endissue{WITH-COMPILATION-UNIT:NEW-MACRO}
  570. \endcom
  571. %-------------------- System Construction Variables --------------------
  572. %%% ========== *FEATURES*
  573. \begincom{*features*}\ftype{Variable}
  574. \label Value Type::
  575. a \term{proper list}.
  576. \label Initial Value::
  577. %A \term{list}, the specific \term{elements} of which are
  578. \term{implementation-dependent}.
  579. \label Description::
  580. %% 25.4.2 12
  581. \Thevalueof{*features*} is called the \term{features list}.
  582. It is a \term{list} of \term{symbols}, called \term{features},
  583. that correspond to some aspect of the \term{implementation} or \term{environment}.
  584. Most \term{features} have \term{implementation-dependent} meanings;
  585. The following meanings have been assigned to feature names:
  586. \issue{COMMON-FEATURES:SPECIFY}
  587. \issue{SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD}
  588. \beginlist
  589. \itemitem{\kwd{cltl1}}
  590. If present, indicates that \thepackage{lisp} \term{purports to conform}
  591. to the 1984 specification \CLtL.
  592. It is possible, but not required, for a \term{conforming implementation}
  593. to have this feature because this specification specifies that
  594. its \term{symbols} are to be in \thepackage{common-lisp},
  595. not the \packref{lisp} package.
  596. \itemitem{\kwd{cltl2}}
  597. If present, indicates that the implementation \term{purports to conform}
  598. to \CLtLTwo.
  599. This feature must not be present in any \term{conforming implementation},
  600. since conformance to that document is not compatible with conformance
  601. to this specification.
  602. The name, however, is reserved by this specification in order to help
  603. programs distinguish implementations which conform to that document
  604. from implementations which conform to this specification.
  605. \itemitem{\kwd{ieee-floating-point}}
  606. If present, indicates that the implementation \term{purports to conform}
  607. to the requirements of \IEEEFloatingPoint.
  608. \itemitem{\kwd{x3j13}}
  609. If present, indicates that the implementation conforms to some
  610. particular working draft of this specification,
  611. or to some subset of features that approximates a belief about
  612. what this specification might turn out to contain.
  613. A \term{conforming implementation} might or might not contain
  614. such a feature.
  615. (This feature is intended primarily as a stopgap in order to
  616. provide implementors something to use prior to the availability
  617. of a draft standard, in order to discourage them from introducing
  618. the \kwd{draft-ansi-cl} and \kwd{ansi-cl} \term{features} prematurely.)
  619. \itemitem{\kwd{draft-ansi-cl}}
  620. If present, indicates that the \term{implementation}
  621. \term{purports to conform} to the first full draft of this specification,
  622. which went to public review in 1992.
  623. A \term{conforming implementation}
  624. which has the \kwd{draft-ansi-cl-2} or \kwd{ansi-cl} \term{feature}
  625. is not permitted to retain the \kwd{draft-ansi-cl} \term{feature}
  626. since incompatible changes were made subsequent to the first draft.
  627. \itemitem{\kwd{draft-ansi-cl-2}}
  628. If present, indicates that a second full draft of this specification
  629. has gone to public review, and that the \term{implementation}
  630. \term{purports to conform} to that specification.
  631. (If additional public review drafts are produced, this keyword
  632. will continue to refer to the second draft, and additional keywords
  633. will be added to identify conformance with such later drafts.
  634. As such, the meaning of this keyword can be relied upon not to
  635. change over time.)
  636. A \term{conforming implementation} which has the \kwd{ansi-cl}
  637. \term{feature} is only permitted to retain the \kwd{draft-ansi-cl}
  638. \term{feature} if the finally approved standard is not incompatible
  639. with the draft standard.
  640. \itemitem{\kwd{ansi-cl}}
  641. If present, indicates that this specification has been adopted by ANSI
  642. as an official standard, and that the \term{implementation}
  643. \term{purports to conform}.
  644. \itemitem{\kwd{common-lisp}}
  645. This feature must appear in \varref{*features*} for any implementation that
  646. has one or more of the features \kwd{x3j13}, \kwd{draft-ansi-cl},
  647. or \kwd{ansi-cl}. It is intended that it should also appear in
  648. implementations which have the features \kwd{cltl1} or \kwd{cltl2},
  649. but this specification cannot force such behavior. The intent is
  650. that this feature should identify the language family named ``Common Lisp,''
  651. rather than some specific dialect within that family.
  652. \endlist
  653. \endissue{SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD}
  654. \endissue{COMMON-FEATURES:SPECIFY}
  655. \label Examples:\None.
  656. \label Affected By:\None.
  657. \label See Also::
  658. {\secref\ReadTimeConditionals},
  659. {\secref\StandardMacroChars}
  660. \label Notes::
  661. %% 25.4.2 13
  662. \Thevalueof{*features*} is used by the \f{\#+} and \f{\#-} reader syntax.
  663. \issue{SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD}
  664. \term{Symbols} in the \term{features list} may be in any \term{package},
  665. but in practice they are generally in \thepackage{keyword}.
  666. This is because \packref{keyword} is the \term{package} used by default
  667. when \term{reading}\meaning{2} \term{feature expressions}
  668. in the \f{\#+} and \f{\#-} \term{reader macros}.
  669. \term{Code} that needs to name a \term{feature}\meaning{2} in a
  670. \term{package} $P$ (other than \packref{keyword}) can do so
  671. by making explicit use of a \term{package prefix} for $P$,
  672. but note that such \term{code} must also assure that the \term{package} $P$
  673. exists in order for the \term{feature expression} to be \term{read}\meaning{2}---even
  674. in cases where the \term{feature expression} is expected to fail.
  675. \endissue{SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD}
  676. It is generally considered wise for an \term{implementation} to include
  677. one or more \term{features} identifying the specific \term{implementation},
  678. so that conditional expressions can be written which distinguish
  679. idiosyncrasies of one \term{implementation} from those of another.
  680. Since features are normally \term{symbols} in \thepackage{keyword}
  681. where name collisions might easily result, and since no uniquely defined mechanism
  682. is designated for deciding who has the right to use which \term{symbol} for
  683. what reason, a conservative strategy is to prefer names derived from
  684. one's own company or product name, since those names are often trademarked
  685. and are hence less likely to be used unwittingly by another \term{implementation}.
  686. \endcom
  687. %%% ========== *COMPILE-FILE-PATHNAME*
  688. %%% ========== *COMPILE-FILE-TRUENAME*
  689. \begincom{*compile-file-pathname*, *compile-file-truename*}\ftype{Variable}
  690. \issue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  691. \label Value Type::
  692. \Thevalueof{*compile-file-pathname*} must always be a \term{pathname} or \nil.
  693. \Thevalueof{*compile-file-truename*} must always be a \term{physical pathname} or \nil.
  694. \label Initial Value::
  695. \nil.
  696. \label Description::
  697. During a call to \funref{compile-file},
  698. \varref{*compile-file-pathname*} is \term{bound} to
  699. the \term{pathname} denoted by the first argument to \funref{compile-file},
  700. merged against the defaults;
  701. that is, it is \term{bound} to \f{(pathname (merge-pathnames \param{input-file}))}.
  702. During the same time interval,
  703. \varref{*compile-file-truename*} is \term{bound} to
  704. the \term{truename} of the \term{file} being \term{compiled}.
  705. At other times, the \term{value} of these \term{variables} is \nil.
  706. If a \term{break loop} is entered while \funref{compile-file} is ongoing,
  707. it is \term{implementation-dependent} whether these \term{variables} retain
  708. the \term{values} they had just prior to entering the \term{break loop}
  709. or whether they are \term{bound} to \nil.
  710. The consequences are unspecified if
  711. an attempt is made to \term{assign} or \term{bind} either of these \term{variables}.
  712. \label Examples:\None.
  713. \label Affected By::
  714. The \term{file system}.
  715. \label See Also::
  716. \funref{compile-file}
  717. \label Notes:\None.
  718. %% This contradicts the "unspecified" above.
  719. % Except in the unusual situation of trying to simulate a facility similar to
  720. % \funref{compile-file}, programs are not expected to \term{assign} or \term{bind}
  721. % this variable.
  722. \endissue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  723. \endcom
  724. %%% ========== *LOAD-PATHNAME*
  725. %%% ========== *LOAD-TRUENAME*
  726. \begincom{*load-pathname*, *load-truename*}\ftype{Variable}
  727. \issue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  728. \label Value Type::
  729. \Thevalueof{*load-pathname*} must always be a \term{pathname} or \nil.
  730. \Thevalueof{*load-truename*} must always be a \term{physical pathname} or \nil.
  731. \label Initial Value::
  732. \nil.
  733. \label Description::
  734. During a call to \funref{load},
  735. \varref{*load-pathname*} is \term{bound} to
  736. the \term{pathname} denoted by the the first argument to \funref{load},
  737. merged against the defaults;
  738. that is, it is \term{bound} to \f{(pathname (merge-pathnames \param{filespec}))}.
  739. During the same time interval,
  740. \varref{*load-truename*} is \term{bound} to
  741. the \term{truename} of the \term{file} being loaded.
  742. At other times, the \term{value} of these \term{variables} is \nil.
  743. If a \term{break loop} is entered while \funref{load} is ongoing,
  744. it is \term{implementation-dependent} whether these \term{variables} retain
  745. the \term{values} they had just prior to entering the \term{break loop}
  746. or whether they are \term{bound} to \nil.
  747. The consequences are unspecified if
  748. an attempt is made to \term{assign} or \term{bind} either of these \term{variables}.
  749. \label Examples:\None.
  750. \label Affected By::
  751. The \term{file system}.
  752. \label See Also::
  753. \funref{load}
  754. \label Notes:\None.
  755. \endissue{LOAD-TRUENAME:NEW-PATHNAME-VARIABLES}
  756. \endcom
  757. %%% ========== *COMPILE-PRINT*
  758. %%% ========== *COMPILE-VERBOSE*
  759. \begincom{*compile-print*, *compile-verbose*}\ftype{Variable}
  760. \issue{COMPILER-VERBOSITY:LIKE-LOAD}
  761. \label Value Type::
  762. a \term{generalized boolean}.
  763. \label Initial Value::
  764. \term{implementation-dependent}.
  765. \label Description::
  766. \Thevalueof{*compile-print*} is the default value of \thekeyarg{print}
  767. to \funref{compile-file}.
  768. \Thevalueof{*compile-verbose*} is the default value of \thekeyarg{verbose}
  769. to \funref{compile-file}.
  770. \label Examples:\None.
  771. \label Affected By:\None.
  772. \label See Also::
  773. \funref{compile-file}
  774. \label Notes:\None.
  775. \endissue{COMPILER-VERBOSITY:LIKE-LOAD}
  776. \endcom
  777. %%% ========== *LOAD-PRINT*
  778. %%% ========== *LOAD-VERBOSE*
  779. \begincom{*load-print*, *load-verbose*}\ftype{Variable}
  780. \issue{COMPILER-VERBOSITY:LIKE-LOAD}
  781. \label Value Type::
  782. a \term{generalized boolean}.
  783. \label Initial Value::
  784. The initial \term{value} of \varref{*load-print*} is \term{false}.
  785. The initial \term{value} of \varref{*load-verbose*} is \term{implementation-dependent}.
  786. \label Description::
  787. \Thevalueof{*load-print*} is the default value of \thekeyarg{print} to \funref{load}.
  788. %% 23.4.0 8
  789. \Thevalueof{*load-verbose*} is the default value of \thekeyarg{verbose} to \funref{load}.
  790. \label Examples:\None.
  791. \label Affected By:\None.
  792. %The \term{implementation}.
  793. \label See Also::
  794. \funref{load}
  795. \label Notes:\None.
  796. \endissue{COMPILER-VERBOSITY:LIKE-LOAD}
  797. \endcom
  798. %%% ========== *MODULES*
  799. \begincom{*modules*}\ftype{Variable}
  800. \issue{REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91}
  801. \label Value Type::
  802. a \term{list} of \term{strings}.
  803. \label Initial Value::
  804. \term{implementation-dependent}.
  805. \label Description::
  806. %% 11.8.0 2
  807. \Thevalueof{*modules*} is a list of names of the modules
  808. that have been loaded into the current \term{Lisp image}.
  809. \label Examples:\None.
  810. \label Affected By::
  811. \funref{provide}
  812. \label See Also::
  813. \funref{provide},
  814. \funref{require}
  815. % deprecation note was missing --sjl 4 Mar 92
  816. \label Notes::
  817. The variable \varref{*modules*} is deprecated.
  818. \endissue{REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91}
  819. \endcom
  820. %%% ========== PROVIDE
  821. %%% ========== REQUIRE
  822. \begincom{provide, require}\ftype{Function}
  823. \issue{REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91}
  824. \label Syntax::
  825. \DefunWithValues provide {module-name} {\term{implementation-dependent}}
  826. \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  827. %% "pathname" => "pathname list" per X3J13. -kmp 05-Oct-93
  828. \DefunWithValues require {module-name {\opt} pathname-list} {\term{implementation-dependent}}
  829. \endissue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  830. \label Arguments and Values::
  831. %KMP: Maybe should be "module name designator"?
  832. % Oh well. This is the only use, so leave it for now.
  833. \param{module-name}---a \term{\symbolnamedesignator}.
  834. \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  835. \param{pathname-list}---\nil, or
  836. a \term{designator}
  837. for a \term{non-empty} \term{list} of \term{pathname designators}.
  838. \Default{\nil}
  839. \endissue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  840. \label Description::
  841. %% 11.8.0 4
  842. \funref{provide} adds the \param{module-name} to the \term{list} held by
  843. \varref{*modules*}, if such a name is not already present.
  844. %% 11.8.0 5
  845. \funref{require} tests for the presence of the \param{module-name} in the
  846. \term{list} held by \varref{*modules*}.
  847. If it is present, \funref{require} immediately returns.
  848. \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  849. Otherwise, an attempt is made to load an appropriate set of \term{files} as follows:
  850. The \param{pathname-list} argument, if \term{non-nil},
  851. specifies a list of \term{pathnames} to be loaded in order, from left to right.
  852. If the \param{pathname-list} is \nil,
  853. an \term{implementation-dependent} mechanism will be invoked in an attempt
  854. to load the module named \param{module-name};
  855. if no such module can be loaded, an error \oftype{error} is signaled.
  856. \endissue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  857. Both functions use \funref{string=} to test for the presence of a \param{module-name}.
  858. \label Examples::
  859. \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  860. % %% 11.8.0 6 (CLtL Table 11-1: An Initialization File)
  861. %
  862. % \code
  863. % ;;;; New and improved lisp init file for I. Newton
  864. %
  865. % ;;; Set up the CL-USER package the way I like it.
  866. % (require "CALCULUS") ; I use CALCULUS a lot. Load it.
  867. % (use-package "CALCULUS") ; Get easy access to exported symbols.
  868. %
  869. % (require "NEWTONIAN-MECHANICS") ;Ditto for NEWTONIAN-MECHANICS
  870. % (use-package "NEWTONIAN-MECHANICS")
  871. %
  872. % ;;; Ignore that Relativity stuff until they've got it debugged better.
  873. % ;(require "RELATIVITY")
  874. %
  875. % ;;; These are worth loading, but I'll use qualified names, such
  876. % ;;; as PHLOGISTON:MAKE-FIRE-BOTTLE, to get any symbols I might need.
  877. % (require "PHLOGISTON")
  878. % (require "ALCHEMY")
  879. %
  880. % (provide "NEWTON-PERSONAL-PREFERENCES")
  881. % \endcode
  882. \code
  883. ;;; This illustrates a nonportable use of REQUIRE, because it
  884. ;;; depends on the implementation-dependent file-loading mechanism.
  885. (require "CALCULUS")
  886. ;;; This use of REQUIRE is nonportable because of the literal
  887. ;;; physical pathname.
  888. (require "CALCULUS" "/usr/lib/lisp/calculus")
  889. ;;; One form of portable usage involves supplying a logical pathname,
  890. ;;; with appropriate translations defined elsewhere.
  891. (require "CALCULUS" "lib:calculus")
  892. ;;; Another form of portable usage involves using a variable or
  893. ;;; table lookup function to determine the pathname, which again
  894. ;;; must be initialized elsewhere.
  895. (require "CALCULUS" *calculus-module-pathname*)
  896. \endcode
  897. \endissue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT}
  898. \label Side Effects::
  899. \funref{provide} modifies \varref{*modules*}.
  900. \label Affected By::
  901. The specific action taken by \funref{require} is affected by calls to \funref{provide}
  902. (or, in general, any changes to \thevalueof{*modules*}).
  903. \label Exceptional Situations::
  904. \Shouldchecktype{module-name}{a \term{\symbolnamedesignator}}
  905. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  906. If \funref{require} fails to perform the requested operation
  907. due to a problem while interacting with the \term{file system},
  908. an error \oftype{file-error} is signaled.
  909. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  910. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  911. An error \oftype{file-error} might be signaled if any \term{pathname}
  912. in \param{pathname-list} is a \term{designator} for a \term{wild} \term{pathname}.
  913. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  914. \label See Also::
  915. \varref{*modules*},
  916. \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  917. {\secref\PathnamesAsFilenames}
  918. \endissue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}
  919. \label Notes::
  920. % deprecation note was missing --sjl 4 Mar 92
  921. The functions \funref{provide} and \funref{require} are deprecated.
  922. %% 11.8.0 3
  923. If a module consists of a single \term{package},
  924. it is customary for the package and module names to be the same.
  925. \endissue{REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91}
  926. \endcom