1 &command_line off
2 &input_line off
3 &ready off
4 &comment_line off
5 &control_line off
6 &goto ENTRY &ec_name
7
8
9 This ec is used to create a new lisp from scratch, or as close to scratch as we
10 ever care to come. Since it would take SO long to compile the compiler
11 interpretively, we cheat and use the existing lisp compiler. This ec exists to
12 handle the various peculiarities of the installation procedure; for example,
13 that none of the pl1 programs that actually make up the interpreter can be
14 compiled with -optimize.
15
16 This ec takes no command line arguments; it prompts for everything it needs.
17 If you read all the comments that precede the third executable statement, you
18 will understand how to use this ec, via its main entrypoint:
19
20 make_lisp_interpreter.ec
21
22 The subroutine entrypoints are designed to be used to facilitate lisp
23 development; don't call them directly unless you know how the ec works. It is
24 pretty self contained; it adds all the names to itself that it needs. Note
25 that leaving out all the comment chars in this document not only made it easier
26 to edit, but significantly improves the performance of this ec.
27
28 This ec produces the following six object programs to be installed in a system
29 library:
30
31 bound_lisp_intrprtr_
32 bound_lisp_compiler_
33 bound_lisp_library_
34 lisp_standard_environment_
35 compiler.sv.lisp
36 lap.sv.lisp
37
38 It also produces three directories, which respectively contain the source
39 archives, the object archives, and the include files. This contents of these
40 directories are to be installed in various places in LDD. The archives are
41 ready for installation; the names of all the archive components are on the
42 archives, they have been sorted, and the bound segments have been produced
43 using the object archives as they are.
44
45 Not all of the include files need be installed; all the include files which are
46 specific to lisp will be in the directory; a list of changed include files
47 which must be replaced is produced by the ec as it runs. Any include file
48 which has "lisp" as part of its name, and perhaps others, which do not appear
49 in this directory are obsolete and may be deleted. Consult installation
50 instructions, if any, for a list of such segments, if any.
51
52
53 Written: 14 January 1980 by J. Spencer Love^L
54 This ec uses the following programs which are not part of standard service:
55
56 memory mem The RDMS variable managing program for exec_coms. This
57 can be found in >libraries>rdms at MIT. It must be used
58 until either an exec_com with variables is ready or until
59 Honeywell installs an acceptable substitute.
60
61 match nomatch These functions starmatch their first argument against
62 all the rest of their arguments, and return all the
63 strings that meet the named criterion. They can be found
64 in >udd>p>jsl>s at MIT. They must be used until the
65 arguments active function can be completed and installed.
66
67 target This function returns the pathname of the target of a
68 link. It differs from status -link_path in that it
69 always returns a branch, and works correctly if given a
70 branch. Versions exist at MIT in the AML and in the
71 Multics project library. Maybe this will make standard
72 service some day.
73
74 It also depends on the nested &if feature of the exec_com command in >exl>ecd.
75 If this ec is run in an absentee process, the directions outlined in
76 >exl>info>exec_com.usage.info must be followed. This exec_com exists on both
77 MIT and System M, and will be installed in SSS at some time in the future.
78
79 The object files for lisp itself the six object files created by this ec and
80 for these four programs must be shipped to all sites where Multics Lisp is to
81 be brought up, subject to changes in this ec outlined above. Naturally, if
82 lisp is not to be recompiled at the site, only the six object programs produced
83 by this ec need be shipped.
84
85 The following memory variables are used:
86
87 newsourcedir This directory contains the source being picked up, in
88 archives. The names must be of the form bound*_.**.s.archive,
89 the first component must be the same as the associated bound
90 segment name, and all the names of components must be on the
91 archive segments. Also, the include files which are used must
92 be in the segment include_files.archive, in this directory.
93 The bind files must be in this directory, either free
94 standing or as part of an archive. Links in this directory
95 can be used to pick up non-include files from the online
96 libraries or anywhere else. Note that, if a file is part of
97 an archive, the primary name of the segment or link must end
98 in ".archive" so the file will be extracted, not copied.
99 This is prompted for.
100
101 version This is the version number printed out by the new lcp when
102 invoked. This is prompted for.
103
104 workdir This directory will be the working directory during the
105 execution of this ec. It will be created if it does not
106 already exist, and it must be initially empty it will ask
107 permission to clear it if it isn't, so this ec cannot reside
108 there. At the end, it will contain all the executable
109 objects to be installed. It will also contain three
110 subdirectories which contain the source and object archives
111 and all the include files, which are respectively to be
112 installed various places in LDD. This is prompted for.^L
113 listdir This directory contains all the compilation listings. It
114 should have lots of quota. It will also contain copies of
115 the ec's, for dprinting. This directory is not created as
116 a subdir of workdir since about 2000 records of quota are
117 needed to store the listings, and thus better control over
118 this directory may be desired. This is prompted for.
119
120 cmplrdir This directory contains the lisp compiler used to compile the
121 compiler. This is prompted for.
122
123 envdir This directory WILL CONTAIN the new lisp library when it is
124 installed. It is used for autoload initialization. It is
125 very important that this be correct, or tracing, the
126 grinder and the lap function not eq to the lap command
127 will not initialize properly. This is prompted for.
128
129 sourcedir This directory will contain the source archives in
130 installable form and the file include_files.archive, which
131 contains all the include files to be installed in LDD.
132 This directory is automatically created as a subdirectory
133 of workdir.
134
135 objectdir This directory will contain the object archives in
136 installable form. This directory is automatically created
137 as a subdirectory of workdir.
138
139 incldir This directory will contain all the include files to be
140 installed in LDD. This directory is automatically created
141 as a subdir of workdir.
142
143 retry_later This is a list of pl1 programs which compiled with severity
144 greater than zero. The arguments to the compile_sources
145 entrypoint and this become the value of sources when the
146 compile_sources entrypoint is used.
147
148 sources This is a list of all the pl1, alm, and lisp programs to
149 compile. It is used by the compile_sources entrypoint.
150
151 source Name of the source archive or freestanding file, with the
152 value of sourcedir prepended.
153
154 object Name of the object archive, or the first component of the
155 name of the freestanding file, with the value of objectdir
156 prepended.
157
158 command Unsuffixed name of the file currently being processed.^L
159 &label ENTRY
160 &print You are using the wrong version of exec_com. Initiate the EXL version by typing "in >exl>ecd>ec -fc -a", then retry.
161 &quit
162
163
164 &label ENTRY get_for_lisp
165 &
166 memory set source status -pri ||mem newsourcedir>&r1
167 memory set object ||spe ||mem source
168 &if equal &r1 ||mem source
169 &then &goto NOT_IN_ARCHIVE &ec_name
170 answer yes -brief "archive x ||mem newsourcedir>||mem source ||mem workdir>&r1"
171 memory set object ||spe ||mem object s.archive
172 &goto HAVE_SOURCE &ec_name
173
174 &label NOT_IN_ARCHIVE get_for_lisp
175 answer yes -brief "copy ||mem newsourcedir>&r1 ||mem workdir>=="
176 &
177 &label HAVE_SOURCE get_for_lisp
178 &if not exists entry &r1
179 &then &goto ABORT
180 memory set command spe &r1
181 &quit
182
183
184 &label ENTRY get_for_bootstrap
185 &
186 memory set source status -pri ||mem sourcedir>&r1
187 memory set object ||spe ||mem source
188 &if equal &r1 ||mem source
189 &then &goto NOT_IN_ARCHIVE &ec_name
190 answer yes -brief "archive x ||mem sourcedir>||mem source ||mem workdir>&r1"
191 memory set object ||spe ||mem object s.archive
192 &goto HAVE_SOURCE &ec_name
193
194 &label NOT_IN_ARCHIVE get_for_bootstrap
195 answer yes -brief "copy ||mem sourcedir>&r1 ||mem workdir>=="
196 &
197 &label HAVE_SOURCE get_for_bootstrap
198 &if not exists entry &r1
199 &then &goto ABORT
200 memory set command spe &r1
201 &quit
202
203
204 &label ENTRY save_for_lisp
205 &
206 &if equal .suffix ||mem &r1 .archive
207 &then archive default rd &r3 ||mem &r1dir>||mem &r1 &r2
208 &else &if exists argument &r3
209 &then answer yes -brief "copy &r2 ||mem &r1dir>=="
210 &else answer yes -brief "move &r2 ||mem &r1dir>=="
211 &quit^L
212 &label ENTRY compile_for_lisp
213 &
214 ec &ec_dir>get_for_lisp &r2
215 &goto COMPILE
216
217 &label ENTRY compile_for_bootstrap
218 ec &ec_dir>get_for_bootstrap &r2
219 &
220 &label COMPILE
221 &if not exists argument &r3 &then &goto COMPILE_NOLIST
222 link ||mem listdir>||mem command.list
223 ioa_ "^/Compiling ^a" &r2
224 &rf1
225 unlink ||mem command.list
226 &goto EXIT &ec_name
227
228 &label COMPILE_NOLIST
229 &
230 ioa_ "^/Compiling ^a" &r2
231 &rf1
232 &goto EXIT &ec_name
233
234 &label EXIT compile_for_lisp
235 &
236 &if equal &r1 pl1
237 &then &if ngreater severity &r1 0
238 &then memory set retry_later ||do "&rf1" &r2 |mem retry_later
239 &
240 ec &ec_dir>save_for_lisp source &r2
241 ec &ec_dir>save_for_lisp object ||mem command
242 memory set sources ||&ec_dir>nomatch &r2 |mem sources
243 &quit
244
245 &label EXIT compile_for_bootstrap
246 &
247 &if equal &r1 pl1
248 &then &if ngreater severity &r1 0
249 &then memory set retry_later ||do "&rf1" &r2 |mem retry_later
250 &
251 delete &r2
252 ec &ec_dir>save_for_lisp object ||mem command
253 memory set bootsources ||&ec_dir>nomatch &r2 |mem bootsources
254 &quit^L
255 &label ENTRY bind_for_lisp
256 &
257 &if exists argument &ec_dir>match &r2.bind archive_table |segs ||mem objectdir>&r2.**.archive -absolute_pathname
258 &then &goto HAVE_BINDFILE
259 &
260 ec &ec_dir>get_for_lisp &r2.bind
261 &if exists segment ||mem objectdir>&r2.1.archive
262 &then archive ad ||mem objectdir>&r2.1 &r2.bind
263 &else archive ad ||mem objectdir>&r2 &r2.bind
264 ec &ec_dir>process_archive |segs ||mem objectdir>&r2.**.archive -absolute_pathname
265 &
266 &label HAVE_BINDFILE
267 &print
268 bind |segs ||mem objectdir>&r2.**.archive -absolute_pathname
269 delete_acl &r2 .. *.SysDaemon.*
270 set_acl &r2 re *.*.*
271 answer yes -brief "move &r2 ||mem executabledir>=="
272 memory set &r1 ||&ec_dir>nomatch &r2.bind |mem &r1
273 &quit
274
275
276 &label ENTRY process_archive
277 &
278 archive_sort &r1
279 delete_name directory &r1>&ec_dir>nomatch **.*.archive status -name &r1
280 add_name &r1 archive_table &r1
281 &quit^L
282 &label ENTRY rdc_pl1_macro
283 &
284 ec &ec_dir>get_for_lisp &r1.rd
285 ioa_ "^/Compiling ^a.rd" &r1
286 rdc &r1
287 ec &ec_dir>save_for_lisp source &r1.rd
288 &
289 link ||mem listdir>&r1.list
290 ioa_ "^/Compiling ^a.pl1" &r1
291 pl1 &r1 -map -optimize
292 &if ngreater severity pl1 1
293 &then &goto ABORT
294 unlink &r1.list
295 ec &ec_dir>save_for_lisp object &r1 r
296 &
297 ec &ec_dir>get_for_lisp &r2.macro
298 initiate &r1 -force
299 ioa_ "^/Compiling ^a.macro" &r2
300 &r1 &r2.macro
301 delete &r1.pl1 &r1
302 ec &ec_dir>save_for_lisp source &r2.macro
303 &
304 &if not exists segment &r2.alm
305 &then &goto SAVE_INCLUDE
306 &
307 link ||mem listdir>&r2.list
308 ioa_ "^/Compiling ^a.alm" &r2
309 alm &r2 -list
310 unlink &r2.list
311 delete &r2.alm
312 ec &ec_dir>save_for_lisp object &r2
313 &
314 memory set sources ||&ec_dir>nomatch &r2.macro |mem sources
315 &quit
316 &
317 &label SAVE_INCLUDE
318 answer yes -brief "move &r2.incl.alm ||mem incldir>=="
319 &
320 memory set sources ||&ec_dir>nomatch &r2.macro |mem sources
321 &quit^L
322 &label ENTRY initialize
323 &
324 initiate &ec_dir>memory memory mem -force
325 &
326 &if or equal "&q1" -restart -rs &then &goto SKIP_INIT
327 &if exists argument &r1 &then &goto ABORT
328 &
329 memory set newsourcedir path ||response "New source directory?"
330 memory set version ||response "Compiler version?"
331 memory set workdir path ||response "Staging directory?"
332 memory set listdir path ||response "Listing directory?"
333 memory set cmplrdir path ||response "Existing lisp directory?"
334 memory set envdir path ||response "Directory to be installed in?"
335 &
336 memory set sources ||do "&rf1" archive_table segs ||mem newsourcedir>bound*.**.s.archive -absolute_pathname segs ||mem newsourcedir>*.bind
337 memory set retry_later ""
338 &
339 &if not exists directory ||mem listdir
340 &then on command_error,command_question "" -brief "create_dir ||mem listdir"
341 &
342 &if not exists directory ||mem workdir
343 &then &if on command_errorcommand_question "" "create_dir ||mem workdir"
344 &then &goto ABORT
345 &
346 change_wdir ||mem workdir
347 &if exists entry **
348 &then &if query "Clear staging directory?"
349 &then answer yes -brief "delete ** -brief; delete_dir ** -brief; unlink ** -brief"
350 &else &goto ABORT
351 &
352 &if not exists directory ||mem listdir
353 &then &if on command_errorcommand_question "" "create_dir ||mem listdir"
354 &then &goto ABORT
355 &
356 memory set source object executable incldir ||mem workdir>source object executable include
357 create_dir ||mem source object executable incldir
358 add_name ||mem source object executable incldir s o e incl
359 &
360 &label SKIP_INIT
361 &
362 memory set sources ||do "&rf1" |mem retry_later |mem sources
363 memory set retry_later ""
364 &
365 &if exists argument |&ec_dir>match *.lisp |mem sources
366 &then memory set bootsources ||do "&rf1" archive_table segs ||mem newsourcedir>bound*.**.s.archive -absolute_pathname segs ||mem newsourcedir>*.bind
367 &if exists argument |mem bootsources
368 &then memory set cobsources ||match *.lisp archive_table segments ||mem newsourcedir>*.**.s.archive -absolute_pathname
369 &
370 &if exists entry ||mem incldir>**.*.incl.*
371 &then &goto SKIP_EXTRACT
372 change_wdir ||mem incldir
373 archive x ||mem newsourcedir>include_files.archive
374 &if not exists entry lisp_backquote_
375 &then link ||mem cmplrdir>lisp_backquote_
376 &label SKIP_EXTRACT
377 & NOTE: THE FOLLOWING DEPENDS ON THE INCLUDE LIBRARY ORGANIZATION
378 & IF THIS CHANGES, IT MUST BE REFLECTED HERE.
379 set_search_paths translator ||mem incldir >ldd>include
380 &
381 change_wdir ||mem workdir
382 &
383 &quit^L
384 &label ENTRY make_lisp_interpreter
385 &
386 discard_output -osw error_output "add_name &ec_dir>target &r0 compile_for_lisp.ec rdc_pl1_macro.ec make_environments.ec get_for_lisp.ec bind_for_lisp.ec save_for_lisp.ec process_archive.ec initialize.ec cob_lcp_lisp_module.ec get_for_bootstrap.ec compile_for_bootstrap.ec"
387 &
388 ec &ec_dir>initialize &r1
389 &
390 &if exists argument match lisp_subr_tv_.macro |mem sources
391 &then ec &ec_dir>rdc_pl1_macro compile_lisp_subr_tv lisp_subr_tv_
392 &
393 &if exists argument match lisp_error_table_.macro |mem sources
394 &then ec &ec_dir>rdc_pl1_macro compile_lisp_error_table lisp_error_table_
395 &
396 ec &ec_dir>compile_for_lisp pl1 match *.pl1 |mem sources -map -brief_table
397 &
398 ec &ec_dir>compile_for_lisp alm match *.alm |mem sources -list
399 &
400 initiate ||mem cmplrdir>bound_lisp_intrprtr compiler library_ -all -force
401 ec &ec_dir>compile_for_lisp lcp match *.lisp |mem sources
402 &
403 ec &ec_dir>bind_for_lisp sources spe match *.bind mem sources bind
404 &
405 &if exists argument |mem bootsources
406 &then ec &ec_dir>make_environments ||mem version
407 & ***Append version with X if to be installed in EXL***
408 ec &ec_dir>process_archive segments ||mem sourcedir>**.*.archive -absolute_pathname
409 &
410 &print ^/Starting bootstrap.^/
411 unlink ||mem incldir>lisp_backquote_
412 link ||mem executabledir>lisp_backquote_ ||mem incldir>==
413 initiate ||mem executabledir>bound_lisp_intrprtr compiler library_ -all -force
414
415 &
416 & The following code is to be executed only if new c/g strategies are introcued
417 & in lcp, it doesn't work correctly and should be fixed if used
418 &
419 & ec &ec_dir>compile_for_bootstrap lcp match *.lisp mem bootsources -list
420 & &
421 & ec &ec_dir>bind_for_lisp bootsources spe match *.bind mem bootsources bind
422 & &
423 & ec &ec_dir>make_environments ||mem version
424 & &
425
426 & The following statement causes all the lisp programs in lcp
427 & to be compiled and compared
428 ec &ec_dir>cob_lcp_lisp_module mem cobsources
429 &
430
431
432
433 &if exists entry ||mem sourcedir>make_lisp_interpreter.ec
434 &then &if nequal status ||mem sourcedir>make_lisp_interpreter.ec -uid status &r0 -uid
435 &then &quit
436 &else delete ||mem sourcedir>make_lisp_interpreter.ec
437 answer yes -brief "copy &r0 ||mem sourcedir>make_lisp_interpreter.ec"
438 &
439 delete_acl ||mem source object incldir>** .. *.SysDaemon.*
440 set_acl ||mem source object incldir>** r *.*.*
441 &
442 &print ^/Done.^/
443 &print The directory which contains backquote.incl.lisp must have a link to the
444 &print installed version of lisp_backquote_ in bound_lisp_library_.
445 &
446 &quit
447 ^L
448 &label ENTRY make_environments
449 &
450 initiate ||mem executabledir>bound_lisp_intrprtr compiler library_ -all -force
451 ec &ec_dir>get_for_lisp lisp_standard_environment_.ec
452 answer yes -brief "add_name lisp_standard_environment_.ec lisp_nostartup.ec"
453 &print ^/Compiling lisp_nostartup.sv.lisp
454 ec lisp_nostartup ||mem envdir ||mem executabledir
455 &print ^/Compiling lisp_standard_environment_
456 ec lisp_standard_environment_ ||mem envdir ||mem executabledir
457 &if not exists entry ||mem listdir>lisp_standard_environment_.ec
458 &then copy ||mem workdir>lisp_standard_environment_.ec ||mem listdir>==
459 ec &ec_dir>save_for_lisp source lisp_standard_environment_.ec
460 delete_acl lisp_standard_environment_ .. *.SysDaemon.*
461 set_acl lisp_standard_environment_ r *.*.*
462 answer yes -brief "move lisp_standard_environment_ ||mem executabledir>=="
463 &
464 initiate ||mem executabledir>bound_lisp_intrprtr compiler library_ -all -force
465 ec &ec_dir>get_for_lisp make_lcp.ec
466 &print ^/Compiling compiler.sv.lisp
467 ec make_lcp &r1 ||mem envdir ||mem executabledir ||mem executabledir ||mem executabledir
468 &if not exists entry ||mem listdir>make_lcp.ec
469 &then copy ||mem workdir>make_lcp.ec ||mem listdir>==
470 ec &ec_dir>save_for_lisp source make_lcp.ec
471 delete_acl compiler.sv.lisp .. *.SysDaemon.*
472 set_acl compiler.sv.lisp r *.*.*
473 answer yes -brief "move compiler.sv.lisp ||mem executabledir>=="
474 &
475 initiate ||mem executabledir>bound_lisp_intrprtr compiler library_ -all -force
476 ec &ec_dir>get_for_lisp make_lap.ec
477 &print ^/Compiling lap.sv.lisp
478 ec make_lap ||mem executabledir
479 &if not exists entry ||mem listdir>make_lap.ec
480 &then copy ||mem workdir>make_lap.ec ||mem listdir>==
481 ec &ec_dir>save_for_lisp source make_lap.ec
482 delete_acl lap.sv.lisp .. *.SysDaemon.*
483 set_acl lap.sv.lisp r *.*.*
484 answer yes -brief "move lap.sv.lisp ||mem executabledir>=="
485 &
486 delete lisp_nostartup.sv.lisp
487 &
488 &print ^/Finished making environments.^/
489 &quit^L
490 &label ENTRY cob_lcp_lisp_module
491 &
492 ioa_ "^/Compiling ^a" &r1
493 &
494 ec &ec_dir>get_for_bootstrap &r1
495 &
496 file_output ||mem listdir>||mem command.cob -truncate
497 &
498 initiate ||mem executabledir>bound_lisp_intrprtr compiler library_ -all -force
499 lcp &r1
500 &
501 rename ||mem command ===.new
502 ac x ||mem objectdir>||mem object ||mem command
503 &
504 ioa_ "^2/Comparing ^a.boot1 with ^a.boot2:^/" &r1 &r1
505 ioa_$ioa_stream user_i/o "Comparing ^a" &r1
506 &
507 compare_object ||mem command ||mem command.new
508 &
509 revert_output
510 &
511 delete ||mem command ||mem command.new &r1
512 memory set cobsources ||&ec_dir>nomatch &r1 |mem cobsources
513 &
514 &quit
515
516
517 &label ABORT
518 signal can't_make_lisp
519 &goto ABORT