Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#+xcvb (module ())
(in-package :ccl)
(defun finish-outputs ()
(finish-output *standard-output*)
(finish-output *error-output*)
(finish-output *terminal-output*)
(finish-output *trace-output*)
(housekeeping))
(defun show-processes ()
(let ((p (all-processes)))
(format t "~&Total number of running lisp processes: ~d~%~W~%" (length p) p)
(finish-outputs)))
(defun flushing-rep ()
(print-listener-prompt *standard-output*)
(finish-outputs)
(let* ((eof '#.'#:eof)
(sexp (read *standard-input* nil eof nil)))
(when (eq sexp eof)
(finish-outputs)
(throw :flushing-rep-eof nil))
;; This use of eval is OK because it's part of the build infrastructure.
(format t "~&~S~%" (eval sexp))
(finish-outputs)))
(defun flushing-repl ()
(catch :flushing-rep-eof
(loop (flushing-rep))))
(defun single-threaded-toplevel ()
(housekeeping)
;;(show-processes)
;;(flushing-repl)
(listener-function)
(quit 0))
(defclass single-threaded-lisp-development-system (lisp-development-system)
())
(defmethod repl-function-name ((a single-threaded-lisp-development-system))
'single-threaded-toplevel)
(defmethod toplevel-function ((a single-threaded-lisp-development-system) init-file)
(%set-toplevel (or (repl-function-name a) 'single-threaded-toplevel))
(startup-ccl (and *load-lisp-init-file* init-file))
(toplevel))
(defparameter *application* (make-instance 'single-threaded-lisp-development-system))
#|
;; Use it as follows:
(ccl::save-application
"single-threaded-ccl"
;; :toplevel-function #'single-threaded-toplevel
:prepend-kernel t)
|#