~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to info/chap-24.texi

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
@node System Construction, Environment, Reader, Top
 
4
@chapter System Construction
 
5
 
 
6
@menu
 
7
* System Construction Concepts::  
 
8
* System Construction Dictionary::  
 
9
@end menu
 
10
 
 
11
@node System Construction Concepts, System Construction Dictionary, System Construction, System Construction
 
12
@section System Construction Concepts
 
13
 
 
14
@c including concept-systems
 
15
 
 
16
@menu
 
17
* Loading::                     
 
18
* Features::                    
 
19
@end menu
 
20
 
 
21
@node Loading, Features, System Construction Concepts, System Construction Concepts
 
22
@subsection Loading
 
23
 
 
24
To @b{load} a @i{file} is to treat its contents as @i{code}
 
25
and @i{execute} that @i{code}.
 
26
The @i{file} may contain @i{source code}
 
27
@IGindex{source code}
 
28
 or @i{compiled code}
 
29
@IGindex{compiled code}
 
30
.
 
31
 
 
32
A @i{file} containing @i{source code} is called a @i{source file}
 
33
@IGindex{source file}
 
34
.
 
35
@i{Loading} a @i{source file} is accomplished essentially 
 
36
by sequentially @i{reading}_2 the @i{forms} in the file,
 
37
@i{evaluating} each immediately after it is @i{read}.
 
38
 
 
39
A @i{file} containing @i{compiled code} is called a @i{compiled file}
 
40
@IGindex{compiled file}
 
41
.
 
42
@i{Loading} a @i{compiled file} is similar to @i{loading} a @i{source file},
 
43
except that the @i{file} does not contain text but rather an
 
44
@i{implementation-dependent} representation of pre-digested @i{expressions}
 
45
created by the @i{compiler}.  Often, a @i{compiled file} can be @i{loaded}
 
46
more quickly than a @i{source file}.
 
47
See @ref{Compilation}.
 
48
 
 
49
The way in which a @i{source file} is distinguished from a @i{compiled file} 
 
50
is @i{implementation-dependent}.
 
51
 
 
52
@node Features,  , Loading, System Construction Concepts
 
53
@subsection Features
 
54
 
 
55
A @i{feature}
 
56
@IGindex{feature}
 
57
 is an aspect or attribute
 
58
     of @r{Common Lisp}, 
 
59
     of the @i{implementation},
 
60
  or of the @i{environment}.
 
61
A @i{feature} is identified by a @i{symbol}.
 
62
 
 
63
A @i{feature} is said to be @i{present}
 
64
@IGindex{present}
 
65
 in a @i{Lisp image}
 
66
if and only if the @i{symbol} naming it is an @i{element} of the
 
67
@i{list} held by the @i{variable} @b{*features*}, 
 
68
which is called the @i{features list}
 
69
@IGindex{features list}
 
70
.
 
71
 
 
72
@menu
 
73
* Feature Expressions::         
 
74
* Examples of Feature Expressions::  
 
75
@end menu
 
76
 
 
77
@node Feature Expressions, Examples of Feature Expressions, Features, Features
 
78
@subsubsection Feature Expressions
 
79
 
 
80
Boolean combinations of @i{features}, called @i{feature expressions}
 
81
@IGindex{feature expression}
 
82
,
 
83
are used by the @t{#+} and @t{#-} @i{reader macros} in order to
 
84
direct conditional @i{reading} of @i{expressions} by the @i{Lisp reader}.
 
85
 
 
86
The rules for interpreting a @i{feature expression} are as follows:
 
87
 
 
88
@table @asis
 
89
 
 
90
@item @i{feature}  
 
91
If a @i{symbol} naming a @i{feature} is used as a @i{feature expression},
 
92
the @i{feature expression} succeeds if that @i{feature} is @i{present};
 
93
otherwise it fails.
 
94
 
 
95
@item @t{(not @i{feature-conditional})}  
 
96
A @b{not} @i{feature expression} succeeds 
 
97
if its argument @i{feature-conditional} fails;
 
98
otherwise, it succeeds.
 
99
 
 
100
@item @t{(and @{@i{feature-conditional}@}*)}  
 
101
An @b{and} @i{feature expression} succeeds 
 
102
if all of its argument @i{feature-conditionals} succeed;
 
103
otherwise, it fails.
 
104
 
 
105
@item @t{(or @{@i{feature-conditional}@}*)}  
 
106
An @b{or} @i{feature expression} succeeds 
 
107
if any of its argument @i{feature-conditionals} succeed;
 
108
otherwise, it fails.
 
109
 
 
110
@end table
 
111
 
 
112
@node Examples of Feature Expressions,  , Feature Expressions, Features
 
113
@subsubsection Examples of Feature Expressions
 
114
 
 
115
For example, suppose that
 
116
 in @i{implementation} A, the @i{features} @t{spice} and @t{perq} are @i{present},
 
117
                             but the @i{feature} @t{lispm} is not @i{present};
 
118
 in @i{implementation} B, the feature @t{lispm} is @i{present},
 
119
                             but the @i{features} @t{spice} and @t{perq} are
 
120
                              not @i{present};
 
121
 and 
 
122
 in @i{implementation} C, none of the features @t{spice}, @i{lispm}, or @t{perq} are
 
123
                             @i{present}.
 
124
Figure 24--1 shows some sample @i{expressions}, and how they would be 
 
125
@i{read}_2 in these @i{implementations}.
 
126
 
 
127
@format
 
128
@group
 
129
@noindent
 
130
@w{  @t{(cons #+spice "Spice" #-spice "Lispm" x)} }
 
131
@w{  in @i{implementation} A ...    @t{(CONS "Spice" X)}             }
 
132
@w{    in @i{implementation} B ...  @t{(CONS "Lispm" X)}             }
 
133
@w{    in @i{implementation} C ...  @t{(CONS "Lispm" X)}             }
 
134
@w{  @t{(cons #+spice "Spice" #+LispM "Lispm" x)} }
 
135
@w{  in @i{implementation} A ...    @t{(CONS "Spice" X)}             }
 
136
@w{    in @i{implementation} B ...  @t{(CONS "Lispm" X)}             }
 
137
@w{    in @i{implementation} C ...  @t{(CONS X)}                     }
 
138
@w{  @t{(setq a '(1 2 #+perq 43 #+(not perq) 27))} }
 
139
@w{  in @i{implementation} A ...    @t{(SETQ A '(1 2 43))}           }
 
140
@w{    in @i{implementation} B ...  @t{(SETQ A '(1 2 27))}           }
 
141
@w{    in @i{implementation} C ...  @t{(SETQ A '(1 2 27))}           }
 
142
@w{  @t{(let ((a 3) #+(or spice lispm) (b 3)) (foo a))} }
 
143
@w{  in @i{implementation} A ...    @t{(LET ((A 3) (B 3)) (FOO A))}  }
 
144
@w{    in @i{implementation} B ...  @t{(LET ((A 3) (B 3)) (FOO A))}  }
 
145
@w{    in @i{implementation} C ...  @t{(LET ((A 3)) (FOO A))}        }
 
146
@w{  @t{(cons #+Lispm "#+Spice" #+Spice "foo" #-(or Lispm Spice) 7 x)} }
 
147
@w{  in @i{implementation} A ...    @t{(CONS "foo" X)}               }
 
148
@w{    in @i{implementation} B ...  @t{(CONS "#+Spice" X)}           }
 
149
@w{    in @i{implementation} C ...  @t{(CONS 7 X)}                   }
 
150
 
 
151
@noindent
 
152
@w{              Figure 24--1: Features examples             }
 
153
 
 
154
@end group
 
155
@end format
 
156
 
 
157
@c end of including concept-systems
 
158
 
 
159
@node System Construction Dictionary,  , System Construction Concepts, System Construction
 
160
@section System Construction Dictionary
 
161
 
 
162
@c including dict-system-construction
 
163
 
 
164
@menu
 
165
* compile-file::                
 
166
* compile-file-pathname::       
 
167
* load::                        
 
168
* with-compilation-unit::       
 
169
* *features*::                  
 
170
* *compile-file-pathname*::     
 
171
* *load-pathname*::             
 
172
* *compile-print*::             
 
173
* *load-print*::                
 
174
* *modules*::                   
 
175
* provide::                     
 
176
@end menu
 
177
 
 
178
@node compile-file, compile-file-pathname, System Construction Dictionary, System Construction Dictionary
 
179
@subsection compile-file                                                     [Function]
 
180
 
 
181
@code{compile-file}  @i{input-file @r{&key} output-file verbose
 
182
                                                 print external-format}@*
 
183
   @result{}  @i{output-truename, warnings-p, failure-p}
 
184
 
 
185
@subsubheading  Arguments and Values::
 
186
 
 
187
@i{input-file}---a @i{pathname designator}.
 
188
  (Default fillers for unspecified components are taken from
 
189
   @b{*default-pathname-defaults*}.)
 
190
 
 
191
@i{output-file}---a @i{pathname designator}.
 
192
  The default is @i{implementation-defined}.
 
193
 
 
194
@i{verbose}---a @i{generalized boolean}.
 
195
  The default is the @i{value} of @b{*compile-verbose*}.
 
196
 
 
197
@i{print}---a @i{generalized boolean}.
 
198
  The default is the @i{value} of @b{*compile-print*}.
 
199
 
 
200
@i{external-format}---an @i{external file format designator}.
 
201
  The default is @t{:default}.
 
202
 
 
203
@i{output-truename}---a @i{pathname} (the @b{truename} of the output @i{file}),
 
204
   or @b{nil}.
 
205
 
 
206
@i{warnings-p}---a @i{generalized boolean}.
 
207
 
 
208
@i{failure-p}---a @i{generalized boolean}.
 
209
 
 
210
@subsubheading  Description::
 
211
 
 
212
@b{compile-file} transforms the contents of the file specified 
 
213
by @i{input-file} into @i{implementation-dependent} binary data 
 
214
which are placed in the file specified by @i{output-file}.
 
215
 
 
216
The @i{file} to which @i{input-file} refers should be a @i{source file}.
 
217
@i{output-file} can be used to specify an output @i{pathname};
 
218
 
 
219
the actual @i{pathname} of the @i{compiled file} 
 
220
to which @i{compiled code} will be output 
 
221
is computed as if by calling @b{compile-file-pathname}.
 
222
 
 
223
If @i{input-file} or @i{output-file} is a @i{logical pathname},
 
224
it is translated into a @i{physical pathname} as if by calling
 
225
@b{translate-logical-pathname}.
 
226
 
 
227
If @i{verbose} is @i{true},
 
228
@b{compile-file} prints a message in the form of a comment
 
229
(@i{i.e.}, with a leading @i{semicolon})
 
230
to @i{standard output} indicating what @i{file} is being @i{compiled}
 
231
and other useful information.
 
232
If @i{verbose} is @i{false},
 
233
@b{compile-file} does not print 
 
234
this information.
 
235
 
 
236
If @i{print} is @i{true},
 
237
information about @i{top level forms} in the file being
 
238
compiled is printed to @i{standard output}.
 
239
Exactly what is printed is @i{implementation-dependent}, 
 
240
but nevertheless some information is printed.
 
241
If @i{print} is @b{nil}, no information is printed.
 
242
 
 
243
The @i{external-format} specifies the @i{external file format} 
 
244
to be used when opening the @i{file}; see the @i{function} @b{open}.
 
245
@b{compile-file} and @b{load} must cooperate in such a way that
 
246
the resulting @i{compiled file} can be @i{loaded}
 
247
without specifying an @i{external file format} anew; see the @i{function} @b{load}.
 
248
 
 
249
@b{compile-file} binds @b{*readtable*} and @b{*package*}
 
250
to the values they held before processing the file.
 
251
 
 
252
@b{*compile-file-truename*} is bound by @b{compile-file} 
 
253
to hold the @i{truename} of the @i{pathname} of the file being compiled.
 
254
 
 
255
@b{*compile-file-pathname*} is bound by @b{compile-file}
 
256
to hold a @i{pathname} denoted by the first argument to @b{compile-file},
 
257
merged against the defaults;
 
258
that is, @t{(pathname (merge-pathnames @i{input-file}))}.
 
259
 
 
260
The compiled @i{functions} contained in the @i{compiled file} become available
 
261
for use when the @i{compiled file} is @i{loaded} into Lisp.
 
262
 
 
263
Any function definition that is processed by the
 
264
compiler, including @t{#'(lambda ...)} forms and local function
 
265
definitions made by @b{flet}, @b{labels} and @b{defun} forms, 
 
266
result in an @i{object} of @i{type} @b{compiled-function}.  
 
267
 
 
268
The @i{primary value} returned by @b{compile-file}, @i{output-truename},
 
269
is the @b{truename} of the output file, or @b{nil} if the file could not be created.  
 
270
 
 
271
The @i{secondary value}, @i{warnings-p}, is @i{false}
 
272
if no @i{conditions} of @i{type} @b{error} or @b{warning}
 
273
were detected by the compiler, and @i{true} otherwise.
 
274
 
 
275
The @i{tertiary value}, @i{failure-p}, is @i{false}
 
276
if no @i{conditions} of @i{type} @b{error} or @b{warning}
 
277
(other than @b{style-warning})
 
278
were detected by the compiler, and @i{true} otherwise.
 
279
 
 
280
For general information about how @i{files} are processed by the @i{file compiler},
 
281
see @ref{File Compilation}.
 
282
 
 
283
@i{Programs} to be compiled by the @i{file compiler} must only contain
 
284
@i{externalizable objects}; for details on such @i{objects},
 
285
see @ref{Literal Objects in Compiled Files}.
 
286
For information on how to extend the set of @i{externalizable objects},
 
287
see the @i{function} @b{make-load-form} and @ref{Additional Constraints on Externalizable Objects}.
 
288
 
 
289
@subsubheading  Affected By::
 
290
 
 
291
@b{*error-output*},
 
292
 
 
293
@b{*standard-output*}, @b{*compile-verbose*}, @b{*compile-print*}
 
294
 
 
295
The computer's file system.
 
296
@subsubheading  Exceptional Situations::
 
297
 
 
298
For information about errors detected during the compilation process, 
 
299
see @ref{Exceptional Situations in the Compiler}.
 
300
 
 
301
An error of @i{type} @b{file-error} might be signaled if
 
302
@t{(wild-pathname-p @i{input-file})\/} returns true.
 
303
 
 
304
If either the attempt to open the @i{source file} for input
 
305
       or the attempt to open the @i{compiled file} for output
 
306
fails,
 
307
an error of @i{type} @b{file-error} is signaled.
 
308
 
 
309
@subsubheading  See Also::
 
310
 
 
311
@ref{compile}
 
312
,
 
313
@b{declare},
 
314
@ref{eval-when}
 
315
,
 
316
@b{pathname},
 
317
@b{logical-pathname},
 
318
@ref{File System Concepts},
 
319
 
 
320
@ref{Pathnames as Filenames}
 
321
 
 
322
@node compile-file-pathname, load, compile-file, System Construction Dictionary
 
323
@subsection compile-file-pathname                                            [Function]
 
324
 
 
325
@code{compile-file-pathname}  @i{input-file @r{&key} output-file @r{&allow-other-keys}} @result{}  @i{pathname}
 
326
 
 
327
@subsubheading  Arguments and Values::
 
328
 
 
329
@i{input-file}---a @i{pathname designator}.
 
330
  (Default fillers for unspecified components are taken from
 
331
   @b{*default-pathname-defaults*}.)
 
332
 
 
333
@i{output-file}---a @i{pathname designator}.
 
334
 The default is @i{implementation-defined}.
 
335
 
 
336
@i{pathname}---a @i{pathname}.
 
337
 
 
338
@subsubheading  Description::
 
339
 
 
340
Returns the @i{pathname} that @b{compile-file} would write into,
 
341
if given the same arguments.
 
342
 
 
343
The defaults for the @i{output-file} 
 
344
are taken from the @i{pathname} 
 
345
that results from merging the @i{input-file} 
 
346
with the @i{value} of @b{*default-pathname-defaults*},
 
347
except that the type component 
 
348
should default to the appropriate
 
349
@i{implementation-defined} default type for @i{compiled files}.
 
350
 
 
351
If @i{input-file} is a @i{logical pathname} and @i{output-file} 
 
352
is unsupplied, the result is a @i{logical pathname}.
 
353
 
 
354
If @i{input-file} is a @i{logical pathname}, 
 
355
it is translated into a physical pathname as if by calling 
 
356
@b{translate-logical-pathname}.
 
357
 
 
358
If @i{input-file} is a @i{stream}, 
 
359
the @i{stream} can be either open or closed.
 
360
@b{compile-file-pathname} returns the same @i{pathname} after a
 
361
file is closed as it did when the file was open.
 
362
 
 
363
It is an error if @i{input-file} is a @i{stream} that is 
 
364
created with @b{make-two-way-stream}, @b{make-echo-stream},             
 
365
@b{make-broadcast-stream}, @b{make-concatenated-stream},
 
366
@b{make-string-input-stream}, @b{make-string-output-stream}.
 
367
 
 
368
If an implementation supports additional keyword arguments to @b{compile-file}, 
 
369
@b{compile-file-pathname} must accept the same arguments.
 
370
 
 
371
@subsubheading  Examples::
 
372
 
 
373
See @b{logical-pathname-translations}.
 
374
 
 
375
@subsubheading  Exceptional Situations::
 
376
 
 
377
An error of @i{type} @b{file-error} might be signaled if either @i{input-file} or
 
378
@i{output-file} is @i{wild}.
 
379
 
 
380
@subsubheading  See Also::
 
381
 
 
382
@ref{compile-file}
 
383
,
 
384
@b{pathname},
 
385
@b{logical-pathname},
 
386
@ref{File System Concepts},
 
387
 
 
388
@ref{Pathnames as Filenames}
 
389
 
 
390
@node load, with-compilation-unit, compile-file-pathname, System Construction Dictionary
 
391
@subsection load                                                             [Function]
 
392
 
 
393
@code{load}  @i{filespec @r{&key} verbose print
 
394
                                               if-does-not-exist external-format}@*
 
395
   @result{}  @i{generalized-boolean}
 
396
 
 
397
@subsubheading  Arguments and Values::
 
398
 
 
399
@i{filespec}---a @i{stream}, or a @i{pathname designator}.
 
400
 The default is taken from @b{*default-pathname-defaults*}.
 
401
 
 
402
@i{verbose}---a @i{generalized boolean}.
 
403
  The default is the @i{value} of @b{*load-verbose*}.
 
404
 
 
405
@i{print}---a @i{generalized boolean}.
 
406
  The default is the @i{value} of @b{*load-print*}.
 
407
 
 
408
@i{if-does-not-exist}---a @i{generalized boolean}.
 
409
  The default is @i{true}.
 
410
 
 
411
@i{external-format}---an @i{external file format designator}.
 
412
  The default is @t{:default}.
 
413
 
 
414
@i{generalized-boolean}---a @i{generalized boolean}.
 
415
 
 
416
@subsubheading  Description::
 
417
 
 
418
@b{load} @i{loads} the @i{file} named by @i{filespec}
 
419
into the @r{Lisp} environment.
 
420
 
 
421
The manner in which a @i{source file}
 
422
is distinguished from a @i{compiled file} is @i{implementation-dependent}.
 
423
If the file specification is not complete and both a @i{source file} and a 
 
424
@i{compiled file} exist which might match,
 
425
then which of those files @b{load} selects is @i{implementation-dependent}.
 
426
 
 
427
If @i{filespec} is a @i{stream},
 
428
@b{load} determines what kind of @i{stream} it is 
 
429
and loads directly from the @i{stream}.
 
430
 
 
431
If @i{filespec} is a @i{logical pathname},
 
432
it is translated into a @i{physical pathname}
 
433
as if by calling @b{translate-logical-pathname}.
 
434
 
 
435
@b{load} sequentially executes each @i{form} it encounters
 
436
in the @i{file} named by @i{filespec}.
 
437
If the @i{file} is a @i{source file}
 
438
and the @i{implementation} chooses to perform @i{implicit compilation},
 
439
@b{load} must recognize @i{top level forms} 
 
440
as described in @ref{Processing of Top Level Forms}
 
441
and arrange for each @i{top level form} to be executed 
 
442
before beginning @i{implicit compilation} of the next.
 
443
(Note, however, that processing of @b{eval-when} @i{forms}
 
444
by @b{load} is controlled by the @t{:execute} situation.)
 
445
 
 
446
If @i{verbose} is @i{true},
 
447
@b{load} prints a message in the form of a comment
 
448
(@i{i.e.}, with a leading @i{semicolon})
 
449
to @i{standard output} indicating what @i{file} is being @i{loaded}
 
450
and other useful information.
 
451
 
 
452
If @i{verbose} is @i{false}, 
 
453
@b{load} does not print this information.
 
454
 
 
455
If @i{print} is @i{true},
 
456
@b{load} incrementally prints information to @i{standard output}
 
457
showing the progress of the @i{loading} process.
 
458
For a @i{source file},
 
459
this information might mean printing the @i{values} 
 
460
@i{yielded} by each @i{form} in the @i{file}
 
461
as soon as those @i{values} are returned.
 
462
For a @i{compiled file}, 
 
463
what is printed might not reflect precisely the contents of the @i{source file},
 
464
but some information is generally printed.
 
465
If @i{print} is @i{false},
 
466
@b{load} does not print this information.
 
467
 
 
468
If the file named by @i{filespec} is successfully loaded,
 
469
@b{load} returns @i{true}.
 
470
 
 
471
[Reviewer Note by Loosemore: What happens if the file cannot be loaded for some reason other
 
472
than that it doesn't exist?] 
 
473
[Editorial Note by KMP: i.e., can it return NIL? must it?]
 
474
 
 
475
If the file does not exist, 
 
476
the specific action taken depends on @i{if-does-not-exist}:
 
477
if it is @b{nil}, @b{load} returns @b{nil};
 
478
otherwise, @b{load} signals an error.
 
479
 
 
480
The @i{external-format} specifies the @i{external file format} 
 
481
to be used when opening the @i{file} (see the @i{function} @b{open}),
 
482
except that when the @i{file} named by @i{filespec} is a @i{compiled file},
 
483
the @i{external-format} is ignored.
 
484
@b{compile-file} and @b{load} cooperate 
 
485
in an @i{implementation-dependent} way to assure 
 
486
the preservation of the @i{similarity} of @i{characters} 
 
487
referred to in the @i{source file} 
 
488
at the time the @i{source file} was processed by the @i{file compiler} 
 
489
under a given @i{external file format},
 
490
regardless of the value of @i{external-format} 
 
491
at the time the @i{compiled file} is @i{loaded}.
 
492
 
 
493
@b{load} binds @b{*readtable*} and @b{*package*}
 
494
to the values they held before @i{loading} the file.
 
495
 
 
496
@b{*load-truename*} is @i{bound} by @b{load} to hold 
 
497
the @i{truename} of the @i{pathname} of the file being @i{loaded}.
 
498
 
 
499
@b{*load-pathname*} is @i{bound} by @b{load} to hold 
 
500
a @i{pathname} that represents @i{filespec} merged against the defaults.
 
501
That is, @t{(pathname (merge-pathnames @i{filespec}))}.
 
502
 
 
503
@subsubheading  Examples::
 
504
 
 
505
@example
 
506
;Establish a data file...
 
507
 (with-open-file (str "data.in" :direction :output :if-exists :error)
 
508
   (print 1 str) (print '(setq a 888) str) t)
 
509
@result{}  T
 
510
 (load "data.in") @result{}  @i{true}
 
511
 a @result{}  888
 
512
 (load (setq p (merge-pathnames "data.in")) :verbose t)
 
513
; Loading contents of file /fred/data.in
 
514
; Finished loading /fred/data.in
 
515
@result{}  @i{true}
 
516
 (load p :print t) 
 
517
; Loading contents of file /fred/data.in
 
518
;  1
 
519
;  888
 
520
; Finished loading /fred/data.in
 
521
@result{}  @i{true}
 
522
@end example
 
523
 
 
524
@example
 
525
 ;----[Begin file SETUP]----
 
526
 (in-package "MY-STUFF")
 
527
 (defmacro compile-truename () `',*compile-file-truename*)
 
528
 (defvar *my-compile-truename* (compile-truename) "Just for debugging.")
 
529
 (defvar *my-load-pathname* *load-pathname*)
 
530
 (defun load-my-system ()
 
531
   (dolist (module-name '("FOO" "BAR" "BAZ"))
 
532
     (load (merge-pathnames module-name *my-load-pathname*))))
 
533
 ;----[End of file SETUP]----
 
534
 
 
535
 (load "SETUP")
 
536
 (load-my-system)
 
537
@end example
 
538
 
 
539
@subsubheading  Affected By::
 
540
 
 
541
The implementation, and the host computer's file system.
 
542
 
 
543
@subsubheading  Exceptional Situations::
 
544
 
 
545
If @t{:if-does-not-exist} is supplied and is @i{true}, or is not supplied,
 
546
@b{load} signals an error of @i{type} @b{file-error} if the file named by
 
547
@i{filespec} does not exist,
 
548
 
 
549
or if the @i{file system} cannot perform the requested operation.
 
550
 
 
551
An error of @i{type} @b{file-error} might be signaled if
 
552
@t{(wild-pathname-p @i{filespec})} returns @i{true}.
 
553
 
 
554
@subsubheading  See Also::
 
555
 
 
556
@ref{error}
 
557
,
 
558
@ref{merge-pathnames}
 
559
,
 
560
@b{*load-verbose*},
 
561
@b{*default-pathname-defaults*},
 
562
@b{pathname},
 
563
@b{logical-pathname},
 
564
@ref{File System Concepts},
 
565
 
 
566
@ref{Pathnames as Filenames}
 
567
 
 
568
@node with-compilation-unit, *features*, load, System Construction Dictionary
 
569
@subsection with-compilation-unit                                               [Macro]
 
570
 
 
571
@code{with-compilation-unit}  @i{@r{(}[[!@i{option}]]@r{)}
 
572
                   @{@i{form}@}*} @result{}  @i{@{@i{result}@}*}
 
573
 
 
574
@w{@i{option} ::=@t{:override} override}
 
575
 
 
576
@subsubheading  Arguments and Values::
 
577
 
 
578
@i{override}---a @i{generalized boolean}; evaluated.
 
579
 The default is @b{nil}.
 
580
 
 
581
@i{forms}---an @i{implicit progn}.
 
582
 
 
583
@i{results}---the @i{values} returned by the @i{forms}.
 
584
 
 
585
@subsubheading  Description::
 
586
 
 
587
Executes @i{forms} from left to right.
 
588
Within the @i{dynamic environment} of @b{with-compilation-unit},
 
589
actions deferred by the compiler until the end of compilation will be
 
590
deferred until the end of the outermost call to @b{with-compilation-unit}.
 
591
 
 
592
The set of @i{options} permitted may be extended by the implementation,
 
593
but the only @i{standardized} keyword is @t{:override}.
 
594
 
 
595
If nested dynamically only the outer call to 
 
596
@b{with-compilation-unit} has any effect unless the value
 
597
associated with @t{:override} is @i{true}, in which case warnings are
 
598
deferred only to the end of the innermost call for which @i{override} is @i{true}.
 
599
 
 
600
The function @b{compile-file} 
 
601
provides the effect of 
 
602
 
 
603
@example
 
604
 (with-compilation-unit (:override nil) ...)
 
605
@end example
 
606
 
 
607
around its @i{code}.
 
608
 
 
609
Any @i{implementation-dependent} extensions can only be provided as the
 
610
result of an explicit programmer request by use of an
 
611
@i{implementation-dependent} keyword.  @i{Implementations} are forbidden
 
612
from attaching additional meaning to a use of this macro which involves either
 
613
no keywords or just the keyword @t{:override}.
 
614
 
 
615
@subsubheading  Examples::
 
616
 
 
617
If an @i{implementation} would normally defer certain kinds of warnings,
 
618
such as warnings about undefined functions, to the end of a compilation
 
619
unit (such as a @i{file}), the following example shows how to cause those
 
620
warnings to be deferred to the end of the compilation of several files.
 
621
 
 
622
@example
 
623
 (defun compile-files (&rest files)
 
624
   (with-compilation-unit ()
 
625
     (mapcar #'(lambda (file) (compile-file file)) files)))
 
626
 
 
627
 (compile-files "A" "B" "C")
 
628
@end example
 
629
 
 
630
Note however that if the implementation does not normally defer any warnings,
 
631
use of @i{with-compilation-unit} might not have any effect.
 
632
 
 
633
@subsubheading  See Also::
 
634
 
 
635
@ref{compile}
 
636
 
637
@ref{compile-file}
 
638
 
 
639
@node *features*, *compile-file-pathname*, with-compilation-unit, System Construction Dictionary
 
640
@subsection *features*                                                       [Variable]
 
641
 
 
642
@subsubheading  Value Type::
 
643
 
 
644
a @i{proper list}.
 
645
 
 
646
@subsubheading  Initial Value::
 
647
 
 
648
@i{implementation-dependent}.
 
649
 
 
650
@subsubheading  Description::
 
651
 
 
652
The @i{value} of @b{*features*} is called the @i{features list}.  
 
653
It is a @i{list} of @i{symbols}, called @i{features}, 
 
654
that correspond to some aspect of the @i{implementation} or @i{environment}.
 
655
 
 
656
Most @i{features} have @i{implementation-dependent} meanings;
 
657
The following meanings have been assigned to feature names:
 
658
 
 
659
@table @asis
 
660
 
 
661
@item @t{:cltl1}  
 
662
If present, indicates that the @t{LISP} @i{package} @i{purports to conform}
 
663
to the 1984 specification @i{Common Lisp: The Language}.  
 
664
It is possible, but not required, for a @i{conforming implementation} 
 
665
to have this feature because this specification specifies that 
 
666
its @i{symbols} are to be in the @t{COMMON-LISP} @i{package}, 
 
667
not the @t{LISP} package.
 
668
 
 
669
@item @t{:cltl2}  
 
670
If present, indicates that the implementation @i{purports to conform}
 
671
to @i{Common Lisp: The Language, Second Edition}.
 
672
This feature must not be present in any @i{conforming implementation},
 
673
since conformance to that document is not compatible with conformance
 
674
to this specification.
 
675
The name, however, is reserved by this specification in order to help
 
676
programs distinguish implementations which conform to that document
 
677
from implementations which conform to this specification.
 
678
 
 
679
@item @t{:ieee-floating-point}  
 
680
If present, indicates that the implementation @i{purports to conform}
 
681
to the requirements of @i{IEEE Standard for Binary Floating-Point Arithmetic}.
 
682
 
 
683
@item @t{:x3j13}  
 
684
If present, indicates that the implementation conforms to some
 
685
particular working draft of this specification, 
 
686
or to some subset of features that approximates a belief about
 
687
what this specification might turn out to contain.
 
688
A @i{conforming implementation} might or might not contain
 
689
such a feature.
 
690
(This feature is intended primarily as a stopgap in order to 
 
691
provide implementors something to use prior to the availability
 
692
of a draft standard, in order to discourage them from introducing
 
693
the @t{:draft-ansi-cl} and @t{:ansi-cl} @i{features} prematurely.)
 
694
 
 
695
@item @t{:draft-ansi-cl}  
 
696
If present, indicates that the @i{implementation} 
 
697
@i{purports to conform} to the first full draft of this specification,
 
698
which went to public review in 1992.
 
699
A @i{conforming implementation}
 
700
which has the @t{:draft-ansi-cl-2} or @t{:ansi-cl} @i{feature}
 
701
is not permitted to retain the @t{:draft-ansi-cl} @i{feature}
 
702
since incompatible changes were made subsequent to the first draft.
 
703
 
 
704
@item @t{:draft-ansi-cl-2}  
 
705
If present, indicates that a second full draft of this specification
 
706
has gone to public review, and that the @i{implementation} 
 
707
@i{purports to conform} to that specification.
 
708
(If additional public review drafts are produced, this keyword
 
709
 will continue to refer to the second draft, and additional keywords
 
710
 will be added to identify conformance with such later drafts.
 
711
 As such, the meaning of this keyword can be relied upon not to
 
712
 change over time.)
 
713
A @i{conforming implementation} which has the @t{:ansi-cl}
 
714
@i{feature} is only permitted to retain the @t{:draft-ansi-cl} 
 
715
@i{feature} if the finally approved standard is not incompatible
 
716
with the draft standard.
 
717
 
 
718
@item @t{:ansi-cl}  
 
719
If present, indicates that this specification has been adopted by ANSI
 
720
as an official standard, and that the @i{implementation} 
 
721
@i{purports to conform}.
 
722
 
 
723
@item @t{:common-lisp}  
 
724
This feature must appear in @b{*features*} for any implementation that
 
725
has one or more of the features @t{:x3j13}, @t{:draft-ansi-cl},
 
726
or @t{:ansi-cl}.  It is intended that it should also appear in
 
727
implementations which have the features @t{:cltl1} or @t{:cltl2},
 
728
but this specification cannot force such behavior.  The intent is 
 
729
that this feature should identify the language family named ``Common Lisp,''
 
730
rather than some specific dialect within that family.
 
731
 
 
732
@end table
 
733
 
 
734
@subsubheading  See Also::
 
735
 
 
736
@ref{Use of Read-Time Conditionals},
 
737
@ref{Standard Macro Characters}
 
738
 
 
739
@subsubheading  Notes::
 
740
 
 
741
The @i{value} of @b{*features*} is used by the @t{#+} and @t{#-} reader syntax.
 
742
 
 
743
@i{Symbols} in the @i{features list} may be in any @i{package},
 
744
but in practice they are generally in the @t{KEYWORD} @i{package}.
 
745
This is because @t{KEYWORD} is the @i{package} used by default
 
746
when @i{reading}_2 @i{feature expressions} 
 
747
in the @t{#+} and @t{#-} @i{reader macros}.
 
748
@i{Code} that needs to name a @i{feature}_2 in a
 
749
@i{package} P (other than @t{KEYWORD}) can do so
 
750
by making explicit use of a @i{package prefix} for P,
 
751
but note that such @i{code} must also assure that the @i{package} P 
 
752
exists in order for the @i{feature expression} to be @i{read}_2---even
 
753
in cases where the @i{feature expression} is expected to fail.
 
754
 
 
755
It is generally considered wise for an @i{implementation} to include 
 
756
one or more @i{features} identifying the specific @i{implementation},
 
757
so that conditional expressions can be written which distinguish 
 
758
idiosyncrasies of one @i{implementation} from those of another.  
 
759
Since features are normally @i{symbols} in the @t{KEYWORD} @i{package}
 
760
where name collisions might easily result, and since no uniquely defined mechanism
 
761
is designated for deciding who has the right to use which @i{symbol} for
 
762
what reason, a conservative strategy is to prefer names derived from 
 
763
one's own company or product name, since those names are often trademarked
 
764
and are hence less likely to be used unwittingly by another @i{implementation}.
 
765
 
 
766
@node *compile-file-pathname*, *load-pathname*, *features*, System Construction Dictionary
 
767
@subsection *compile-file-pathname*, *compile-file-truename*                 [Variable]
 
768
 
 
769
@subsubheading  Value Type::
 
770
 
 
771
The @i{value} of @b{*compile-file-pathname*} must always be a @i{pathname}          or @b{nil}.
 
772
The @i{value} of @b{*compile-file-truename*} must always be a @i{physical pathname} or @b{nil}.
 
773
 
 
774
@subsubheading  Initial Value::
 
775
 
 
776
@b{nil}.
 
777
 
 
778
@subsubheading  Description::
 
779
 
 
780
During a call to @b{compile-file},
 
781
  @b{*compile-file-pathname*} is @i{bound} to 
 
782
  the @i{pathname} denoted by the first argument to @b{compile-file},
 
783
  merged against the defaults;
 
784
  that is, it is @i{bound} to @t{(pathname (merge-pathnames @i{input-file}))}.
 
785
During the same time interval,
 
786
  @b{*compile-file-truename*} is @i{bound} to
 
787
  the @i{truename} of the @i{file} being @i{compiled}.
 
788
 
 
789
At other times, the @i{value} of these @i{variables} is @b{nil}.
 
790
 
 
791
If a @i{break loop} is entered while @b{compile-file} is ongoing,
 
792
it is @i{implementation-dependent} whether these @i{variables} retain 
 
793
the @i{values} they had just prior to entering the @i{break loop} 
 
794
or whether they are @i{bound} to @b{nil}.
 
795
 
 
796
The consequences are unspecified if 
 
797
an attempt is made to @i{assign} or @i{bind} either of these @i{variables}.
 
798
 
 
799
@subsubheading  Affected By::
 
800
 
 
801
The @i{file system}.
 
802
 
 
803
@subsubheading  See Also::
 
804
 
 
805
@ref{compile-file}
 
806
 
 
807
@node *load-pathname*, *compile-print*, *compile-file-pathname*, System Construction Dictionary
 
808
@subsection *load-pathname*, *load-truename*                                 [Variable]
 
809
 
 
810
@subsubheading  Value Type::
 
811
 
 
812
The @i{value} of @b{*load-pathname*} must always be a @i{pathname}          or @b{nil}.
 
813
The @i{value} of @b{*load-truename*} must always be a @i{physical pathname} or @b{nil}.
 
814
 
 
815
@subsubheading  Initial Value::
 
816
 
 
817
@b{nil}.
 
818
 
 
819
@subsubheading  Description::
 
820
 
 
821
During a call to @b{load},
 
822
  @b{*load-pathname*} is @i{bound} to 
 
823
  the @i{pathname} denoted by the the first argument to @b{load},
 
824
  merged against the defaults; 
 
825
  that is, it is @i{bound} to @t{(pathname (merge-pathnames @i{filespec}))}.
 
826
During the same time interval,
 
827
  @b{*load-truename*} is @i{bound} to
 
828
  the @i{truename} of the @i{file} being loaded.
 
829
 
 
830
At other times, the @i{value} of these @i{variables} is @b{nil}.
 
831
 
 
832
If a @i{break loop} is entered while @b{load} is ongoing,
 
833
it is @i{implementation-dependent} whether these @i{variables} retain 
 
834
the @i{values} they had just prior to entering the @i{break loop} 
 
835
or whether they are @i{bound} to @b{nil}.
 
836
 
 
837
The consequences are unspecified if 
 
838
an attempt is made to @i{assign} or @i{bind} either of these @i{variables}.
 
839
 
 
840
@subsubheading  Affected By::
 
841
 
 
842
The @i{file system}.
 
843
 
 
844
@subsubheading  See Also::
 
845
 
 
846
@ref{load}
 
847
 
 
848
@node *compile-print*, *load-print*, *load-pathname*, System Construction Dictionary
 
849
@subsection *compile-print*, *compile-verbose*                               [Variable]
 
850
 
 
851
@subsubheading  Value Type::
 
852
 
 
853
a @i{generalized boolean}.
 
854
 
 
855
@subsubheading  Initial Value::
 
856
 
 
857
@i{implementation-dependent}.
 
858
 
 
859
@subsubheading  Description::
 
860
 
 
861
The @i{value} of @b{*compile-print*}   is the default value of the @t{:print} @i{argument}
 
862
to @b{compile-file}.
 
863
The @i{value} of @b{*compile-verbose*} is the default value of the @t{:verbose} @i{argument}
 
864
to @b{compile-file}.
 
865
 
 
866
@subsubheading  See Also::
 
867
 
 
868
@ref{compile-file}
 
869
 
 
870
@node *load-print*, *modules*, *compile-print*, System Construction Dictionary
 
871
@subsection *load-print*, *load-verbose*                                     [Variable]
 
872
 
 
873
@subsubheading  Value Type::
 
874
 
 
875
a @i{generalized boolean}.
 
876
 
 
877
@subsubheading  Initial Value::
 
878
 
 
879
The initial @i{value} of @b{*load-print*}   is @i{false}.
 
880
The initial @i{value} of @b{*load-verbose*} is @i{implementation-dependent}.
 
881
 
 
882
@subsubheading  Description::
 
883
 
 
884
The @i{value} of @b{*load-print*}   is the default value of the @t{:print} @i{argument}   to @b{load}.
 
885
The @i{value} of @b{*load-verbose*} is the default value of the @t{:verbose} @i{argument} to @b{load}.
 
886
 
 
887
@subsubheading  See Also::
 
888
 
 
889
@ref{load}
 
890
 
 
891
@node *modules*, provide, *load-print*, System Construction Dictionary
 
892
@subsection *modules*                                                        [Variable]
 
893
 
 
894
@subsubheading  Value Type::
 
895
 
 
896
a @i{list} of @i{strings}.
 
897
 
 
898
@subsubheading  Initial Value::
 
899
 
 
900
@i{implementation-dependent}.
 
901
 
 
902
@subsubheading  Description::
 
903
 
 
904
The @i{value} of @b{*modules*} is a list of names of the modules
 
905
that have been loaded into the current @i{Lisp image}.
 
906
 
 
907
@subsubheading  Affected By::
 
908
 
 
909
@b{provide}
 
910
 
 
911
@subsubheading  See Also::
 
912
 
 
913
@ref{provide}
 
914
,
 
915
@b{require}
 
916
 
 
917
@subsubheading  Notes::
 
918
 
 
919
The variable @b{*modules*} is deprecated.
 
920
 
 
921
@node provide,  , *modules*, System Construction Dictionary
 
922
@subsection provide, require                                                 [Function]
 
923
 
 
924
@code{provide}  @i{module-name} @result{}  @i{@i{implementation-dependent}}
 
925
 
 
926
@code{require}  @i{module-name @r{&optional} pathname-list} @result{}  @i{@i{implementation-dependent}}
 
927
 
 
928
@subsubheading  Arguments and Values::
 
929
 
 
930
@i{module-name}---a @i{string designator}.
 
931
 
 
932
@i{pathname-list}---@b{nil}, or
 
933
                        a @i{designator} 
 
934
                          for a @i{non-empty} @i{list} of @i{pathname designators}.
 
935
 The default is @b{nil}.
 
936
 
 
937
@subsubheading  Description::
 
938
 
 
939
@b{provide} adds the @i{module-name} to the @i{list} held by
 
940
@b{*modules*}, if such a name is not already present.
 
941
 
 
942
@b{require} tests for the presence of the @i{module-name} in the
 
943
@i{list} held by @b{*modules*}.
 
944
If it is present, @b{require} immediately returns.
 
945
 
 
946
Otherwise, an attempt is made to load an appropriate set of @i{files} as follows:
 
947
The @i{pathname-list} argument, if @i{non-nil}, 
 
948
 specifies a list of @i{pathnames} to be loaded in order, from left to right.
 
949
If the @i{pathname-list} is @b{nil},
 
950
an @i{implementation-dependent} mechanism will be invoked in an attempt
 
951
to load the module named @i{module-name};
 
952
if no such module can be loaded, an error of @i{type} @b{error} is signaled.
 
953
 
 
954
Both functions use @b{string=} to test for the presence of a @i{module-name}.
 
955
 
 
956
@subsubheading  Examples::
 
957
 
 
958
@example
 
959
;;; This illustrates a nonportable use of REQUIRE, because it
 
960
;;; depends on the implementation-dependent file-loading mechanism.
 
961
 
 
962
(require "CALCULUS")
 
963
 
 
964
;;; This use of REQUIRE is nonportable because of the literal 
 
965
;;; physical pathname.  
 
966
 
 
967
(require "CALCULUS" "/usr/lib/lisp/calculus")
 
968
 
 
969
;;; One form of portable usage involves supplying a logical pathname,
 
970
;;; with appropriate translations defined elsewhere.
 
971
 
 
972
(require "CALCULUS" "lib:calculus")
 
973
 
 
974
;;; Another form of portable usage involves using a variable or
 
975
;;; table lookup function to determine the pathname, which again
 
976
;;; must be initialized elsewhere.
 
977
 
 
978
(require "CALCULUS" *calculus-module-pathname*)
 
979
@end example
 
980
 
 
981
@subsubheading  Side Effects::
 
982
 
 
983
@b{provide} modifies @b{*modules*}.
 
984
 
 
985
@subsubheading  Affected By::
 
986
 
 
987
The specific action taken by @b{require} is affected by calls to @b{provide}
 
988
(or, in general, any changes to the @i{value} of @b{*modules*}).
 
989
 
 
990
@subsubheading  Exceptional Situations::
 
991
 
 
992
Should signal an error of @i{type} @b{type-error}
 
993
                              if @i{module-name} is not a @i{string designator}.
 
994
 
 
995
If @b{require} fails to perform the requested operation 
 
996
due to a problem while interacting with the @i{file system},
 
997
an error of @i{type} @b{file-error} is signaled.
 
998
 
 
999
An error of @i{type} @b{file-error} might be signaled if any @i{pathname} 
 
1000
in @i{pathname-list} is a @i{designator} for a @i{wild} @i{pathname}.
 
1001
 
 
1002
@subsubheading  See Also::
 
1003
 
 
1004
@b{*modules*},
 
1005
 
 
1006
@ref{Pathnames as Filenames}
 
1007
 
 
1008
@subsubheading  Notes::
 
1009
 
 
1010
The functions @b{provide} and @b{require} are deprecated.
 
1011
 
 
1012
If a module consists of a single @i{package},
 
1013
it is customary for the package and module names to be the same.
 
1014
 
 
1015
@c end of including dict-system-construction
 
1016
 
 
1017
@c %**end of chapter
 
1018