1 | ;;;-*-Mode: LISP; Package: CCL -*- |
---|
2 | ;;; |
---|
3 | ;;; Copyright (C) 1994-2001 Digitool, Inc |
---|
4 | ;;; This file is part of OpenMCL. |
---|
5 | ;;; |
---|
6 | ;;; OpenMCL is licensed under the terms of the Lisp Lesser GNU Public |
---|
7 | ;;; License , known as the LLGPL and distributed with OpenMCL as the |
---|
8 | ;;; file "LICENSE". The LLGPL consists of a preamble and the LGPL, |
---|
9 | ;;; which is distributed with OpenMCL as the file "LGPL". Where these |
---|
10 | ;;; conflict, the preamble takes precedence. |
---|
11 | ;;; |
---|
12 | ;;; OpenMCL is referenced in the preamble as the "LIBRARY." |
---|
13 | ;;; |
---|
14 | ;;; The LLGPL is also available online at |
---|
15 | ;;; http://opensource.franz.com/preamble.html |
---|
16 | |
---|
17 | |
---|
18 | ; l1-boot-lds.lisp |
---|
19 | |
---|
20 | (in-package "CCL") |
---|
21 | |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | (defun command-line-arguments () |
---|
27 | *command-line-argument-list*) |
---|
28 | |
---|
29 | (defun startup-ccl (&optional init-file) |
---|
30 | (with-simple-restart (abort "Abort startup.") |
---|
31 | (let ((init-files (if (listp init-file) init-file (list init-file)))) |
---|
32 | (dolist (init-file init-files) |
---|
33 | (with-simple-restart (continue "Skip loading init file.") |
---|
34 | (when (load init-file :if-does-not-exist nil :verbose nil) |
---|
35 | #+clozure-common-lisp ;; Kludge to help people transition |
---|
36 | (when (equalp (pathname-name init-file) "openmcl-init") |
---|
37 | (warn ">>>>>> The use of openmcl-init.lisp is deprecated. Please rename your init file to ccl-init.lisp")) |
---|
38 | (return))))) |
---|
39 | (flet ((eval-string (s) |
---|
40 | (with-simple-restart (continue "Skip evaluation of ~a" s) |
---|
41 | (eval (read-from-string s)))) |
---|
42 | (load-file (name) |
---|
43 | (with-simple-restart (continue "Skip loading ~s" name) |
---|
44 | (load name)))) |
---|
45 | (dolist (p *lisp-startup-parameters*) |
---|
46 | (let* ((param (cdr p))) |
---|
47 | (case (car p) |
---|
48 | (:gc-threshold |
---|
49 | (multiple-value-bind (n last) (parse-integer param :junk-allowed t) |
---|
50 | (when n |
---|
51 | (if (< last (length param)) |
---|
52 | (case (schar param last) |
---|
53 | ((#\k #\K) (setq n (ash n 10))) |
---|
54 | ((#\m #\M) (setq n (ash n 20))))) |
---|
55 | (set-lisp-heap-gc-threshold n) |
---|
56 | (use-lisp-heap-gc-threshold)))) |
---|
57 | (:eval (eval-string param)) |
---|
58 | (:load (load-file param)))))))) |
---|
59 | |
---|
60 | |
---|
61 | (defun listener-function () |
---|
62 | (progn |
---|
63 | (unless (or *inhibit-greeting* *quiet-flag*) |
---|
64 | (format t "~&Welcome to ~A ~A!~%" |
---|
65 | (lisp-implementation-type) |
---|
66 | (lisp-implementation-version))) |
---|
67 | (toplevel-loop))) |
---|
68 | |
---|
69 | |
---|
70 | (defun make-mcl-listener-process (procname |
---|
71 | input-stream |
---|
72 | output-stream |
---|
73 | cleanup-function |
---|
74 | &key |
---|
75 | (initial-function #'listener-function) |
---|
76 | (close-streams t) |
---|
77 | (class 'process) |
---|
78 | (control-stack-size *default-control-stack-size*) |
---|
79 | (value-stack-size *default-value-stack-size*) |
---|
80 | (temp-stack-size *default-temp-stack-size*) |
---|
81 | (echoing t) |
---|
82 | (process)) |
---|
83 | (let ((p (if (typep process class) |
---|
84 | (progn |
---|
85 | (setf (process-thread process) |
---|
86 | (new-thread procname control-stack-size value-stack-size temp-stack-size)) |
---|
87 | process) |
---|
88 | (make-process procname |
---|
89 | :class class |
---|
90 | :stack-size control-stack-size |
---|
91 | :vstack-size value-stack-size |
---|
92 | :tstack-size temp-stack-size)))) |
---|
93 | (process-preset p #'(lambda () |
---|
94 | (let ((*terminal-io* |
---|
95 | (if echoing |
---|
96 | (make-echoing-two-way-stream |
---|
97 | input-stream output-stream) |
---|
98 | (make-two-way-stream |
---|
99 | input-stream output-stream)))) |
---|
100 | (unwind-protect |
---|
101 | (progn |
---|
102 | (add-auto-flush-stream output-stream) |
---|
103 | (let* ((shared-input |
---|
104 | (input-stream-shared-resource |
---|
105 | input-stream))) |
---|
106 | (when shared-input |
---|
107 | (setf (shared-resource-primary-owner |
---|
108 | shared-input) |
---|
109 | *current-process*))) |
---|
110 | (application-ui-operation |
---|
111 | *application* |
---|
112 | :note-current-package *package*) |
---|
113 | (funcall initial-function)) |
---|
114 | (remove-auto-flush-stream output-stream) |
---|
115 | (funcall cleanup-function) |
---|
116 | (when close-streams |
---|
117 | (close input-stream) |
---|
118 | (close output-stream)))))) |
---|
119 | (process-enable p) |
---|
120 | p)) |
---|
121 | |
---|
122 | |
---|
123 | ; End of l1-boot-lds.lisp |
---|