c9986bf291332f9666dcdd856df7b2fc9cdd3dcd
[sbcl.git] / src / code / toplevel.lisp
1 ;;;; stuff related to the toplevel read-eval-print loop, plus some
2 ;;;; other miscellaneous functions that we don't have any better place
3 ;;;; for
4
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
13
14 (in-package "SB!IMPL")
15 \f
16 ;;;; magic specials initialized by GENESIS
17
18 ;;; FIXME: The DEFVAR here is redundant with the (DECLAIM (SPECIAL ..))
19 ;;; of all static symbols in early-impl.lisp.
20 (progn
21   (defvar sb!vm::*current-catch-block*)
22   (defvar sb!vm::*current-unwind-protect-block*)
23   #!+hpux (defvar sb!vm::*c-lra*)
24   (defvar *free-interrupt-context-index*))
25 \f
26 ;;; specials initialized by !COLD-INIT
27
28 ;;; FIXME: These could be converted to DEFVARs.
29 (declaim (special #!+(or x86 x86-64) *pseudo-atomic-bits*
30                   *allow-with-interrupts*
31                   *interrupts-enabled*
32                   *interrupt-pending*
33                   *type-system-initialized*))
34
35 (defvar *cold-init-complete-p*)
36
37 ;;; counts of nested errors (with internal errors double-counted)
38 (defvar *maximum-error-depth*)
39 (defvar *current-error-depth*)
40
41 ;;;; default initfiles
42
43 (defun sysinit-pathname ()
44   (or (let ((sbcl-homedir (sbcl-homedir-pathname)))
45         (when sbcl-homedir
46           (probe-file (merge-pathnames "sbclrc" sbcl-homedir))))
47       #!+win32
48       (merge-pathnames "sbcl\\sbclrc"
49                        (sb!win32::get-folder-pathname
50                         sb!win32::csidl_common_appdata))
51       #!-win32
52       "/etc/sbclrc"))
53
54 (defun userinit-pathname ()
55   (merge-pathnames ".sbclrc" (user-homedir-pathname)))
56
57 (defvar *sysinit-pathname-function* #'sysinit-pathname
58   #!+sb-doc
59   "Designator for a function of zero arguments called to obtain a pathname
60 designator for the default sysinit file, or NIL. If the function returns NIL,
61 no sysinit file is used unless one has been specified on the command-line.")
62
63 (defvar *userinit-pathname-function* #'userinit-pathname
64   #!+sb-doc
65   "Designator for a function of zero arguments called to obtain a pathname
66 designator or a stream for the default userinit file, or NIL. If the function
67 returns NIL, no userinit file is used unless one has been specified on the
68 command-line.")
69
70 \f
71 ;;;; miscellaneous utilities for working with with TOPLEVEL
72
73 ;;; Execute BODY in a context where any %END-OF-THE-WORLD (thrown e.g.
74 ;;; by QUIT) is caught and any final processing and return codes are
75 ;;; handled appropriately.
76 (defmacro handling-end-of-the-world (&body body)
77   (with-unique-names (caught)
78     `(without-interrupts
79        (let ((,caught
80                (catch '%end-of-the-world
81                  (unwind-protect
82                       (with-local-interrupts ,@body (quit))
83                    (handler-case
84                        (with-local-interrupts
85                          (call-hooks "exit" *exit-hooks* :on-error :warn))
86                      (serious-condition ()
87                        1))))))
88          ;; If user called QUIT and exit hooks were OK, the status is what it
89          ;; is -- even eg. streams cannot be flushed anymore. Even if
90          ;; something goes wrong now, we still report what was asked. We still
91          ;; want to have %END-OF-THE-WORLD visible, though.
92          (catch '%end-of-the-world
93            (handler-case
94                (unwind-protect
95                     (progn
96                       (flush-standard-output-streams)
97                       (sb!thread::terminate-session))
98                  (sb!unix:unix-exit ,caught))
99              (serious-condition ())))))))
100 \f
101 ;;;; working with *CURRENT-ERROR-DEPTH* and *MAXIMUM-ERROR-DEPTH*
102
103 ;;; INFINITE-ERROR-PROTECT is used by ERROR and friends to keep us out
104 ;;; of hyperspace.
105 (defmacro infinite-error-protect (&rest forms)
106   `(unless (infinite-error-protector)
107      (/show0 "back from INFINITE-ERROR-PROTECTOR")
108      (let ((*current-error-depth* (1+ *current-error-depth*)))
109        (/show0 "in INFINITE-ERROR-PROTECT, incremented error depth")
110        ;; arbitrary truncation
111        #!+sb-show (sb!debug:backtrace 8)
112        ,@forms)))
113
114 ;;; a helper function for INFINITE-ERROR-PROTECT
115 (defun infinite-error-protector ()
116   (/show0 "entering INFINITE-ERROR-PROTECTOR, *CURRENT-ERROR-DEPTH*=..")
117   (/hexstr *current-error-depth*)
118   (cond ((not *cold-init-complete-p*)
119          (%primitive print "Argh! error in cold init, halting")
120          (%primitive sb!c:halt))
121         ((or (not (boundp '*current-error-depth*))
122              (not (realp   *current-error-depth*))
123              (not (boundp '*maximum-error-depth*))
124              (not (realp   *maximum-error-depth*)))
125          (%primitive print "Argh! corrupted error depth, halting")
126          (%primitive sb!c:halt))
127         ((> *current-error-depth* *maximum-error-depth*)
128          (/show0 "*MAXIMUM-ERROR-DEPTH*=..")
129          (/hexstr *maximum-error-depth*)
130          (/show0 "in INFINITE-ERROR-PROTECTOR, calling ERROR-ERROR")
131          (error-error "Help! "
132                       *current-error-depth*
133                       " nested errors. "
134                       "SB-KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.")
135          t)
136         (t
137          (/show0 "returning normally from INFINITE-ERROR-PROTECTOR")
138          nil)))
139
140 ;;; FIXME: I had a badly broken version of INFINITE-ERROR-PROTECTOR at
141 ;;; one point (shown below), and SBCL cross-compiled it without
142 ;;; warning about FORMS being undefined. Check whether that problem
143 ;;; (missing warning) is repeatable in the final system and if so, fix
144 ;;; it.
145 #|
146 (defun infinite-error-protector ()
147   `(cond ((not *cold-init-complete-p*)
148           (%primitive print "Argh! error in cold init, halting")
149           (%primitive sb!c:halt))
150          ((or (not (boundp '*current-error-depth*))
151               (not (realp   *current-error-depth*))
152               (not (boundp '*maximum-error-depth*))
153               (not (realp   *maximum-error-depth*)))
154           (%primitive print "Argh! corrupted error depth, halting")
155           (%primitive sb!c:halt))
156          ((> *current-error-depth* *maximum-error-depth*)
157           (/show0 "in INFINITE-ERROR-PROTECTOR, calling ERROR-ERROR")
158           (error-error "Help! "
159                        *current-error-depth*
160                        " nested errors. "
161                        "SB-KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.")
162           (progn ,@forms)
163           t)
164          (t
165           (/show0 "in INFINITE-ERROR-PROTECTOR, returning normally")
166           nil)))
167 |#
168 \f
169 ;;;; miscellaneous external functions
170
171 (defun sleep (seconds)
172   #!+sb-doc
173   "This function causes execution to be suspended for SECONDS. SECONDS may be
174 any non-negative real number."
175   (when (or (not (realp seconds))
176             (minusp seconds))
177     (error 'simple-type-error
178            :format-control "invalid argument to SLEEP: ~S"
179            :format-arguments (list seconds)
180            :datum seconds
181            :expected-type '(real 0)))
182   #!-win32
183   (multiple-value-bind (sec nsec)
184       (if (integerp seconds)
185           (values seconds 0)
186           (multiple-value-bind (sec frac)
187               (truncate seconds)
188             (values sec (truncate frac 1e-9))))
189     ;; nanosleep() accepts time_t as the first argument, but on some platforms
190     ;; it is restricted to 100 million seconds. Maybe someone can actually
191     ;; have a reason to sleep for over 3 years?
192     (loop while (> sec (expt 10 8))
193           do (decf sec (expt 10 8))
194              (sb!unix:nanosleep (expt 10 8) 0))
195     (sb!unix:nanosleep sec nsec))
196   #!+win32
197   (sb!win32:millisleep (truncate (* seconds 1000)))
198   nil)
199 \f
200 ;;;; the default toplevel function
201
202 (defvar / nil
203   #!+sb-doc
204   "a list of all the values returned by the most recent top level EVAL")
205 (defvar //  nil #!+sb-doc "the previous value of /")
206 (defvar /// nil #!+sb-doc "the previous value of //")
207 (defvar *   nil #!+sb-doc "the value of the most recent top level EVAL")
208 (defvar **  nil #!+sb-doc "the previous value of *")
209 (defvar *** nil #!+sb-doc "the previous value of **")
210 (defvar +   nil #!+sb-doc "the value of the most recent top level READ")
211 (defvar ++  nil #!+sb-doc "the previous value of +")
212 (defvar +++ nil #!+sb-doc "the previous value of ++")
213 (defvar -   nil #!+sb-doc "the form currently being evaluated")
214
215 (defun interactive-eval (form &key (eval #'eval))
216   #!+sb-doc
217   "Evaluate FORM, returning whatever it returns and adjusting ***, **, *,
218 +++, ++, +, ///, //, /, and -."
219   (setf - form)
220   (unwind-protect
221        (let ((results (multiple-value-list (funcall eval form))))
222          (setf /// //
223                // /
224                / results
225                *** **
226                ** *
227                * (car results)))
228     (setf +++ ++
229           ++ +
230           + -))
231   (unless (boundp '*)
232     ;; The bogon returned an unbound marker.
233     ;; FIXME: It would be safer to check every one of the values in RESULTS,
234     ;; instead of just the first one.
235     (setf * nil)
236     (cerror "Go on with * set to NIL."
237             "EVAL returned an unbound marker."))
238   (values-list /))
239
240 ;;; Flush anything waiting on one of the ANSI Common Lisp standard
241 ;;; output streams before proceeding.
242 (defun flush-standard-output-streams ()
243   (dolist (name '(*debug-io*
244                   *error-output*
245                   *query-io*
246                   *standard-output*
247                   *trace-output*
248                   *terminal-io*))
249     ;; FINISH-OUTPUT may block more easily than FORCE-OUTPUT
250     (force-output (symbol-value name)))
251   (values))
252
253 (defun process-init-file (specified-pathname kind)
254   (multiple-value-bind (context default-function)
255       (ecase kind
256         (:system
257          (values "sysinit" *sysinit-pathname-function*))
258         (:user
259          (values "userinit" *userinit-pathname-function*)))
260     (if specified-pathname
261         (with-open-file (stream (parse-native-namestring specified-pathname)
262                                 :if-does-not-exist nil)
263           (if stream
264               (load-as-source stream :context context)
265               (cerror "Ignore missing init file"
266                       "The specified ~A file ~A was not found."
267                       context specified-pathname)))
268         (let ((default (funcall default-function)))
269           (when default
270             (with-open-file (stream (pathname default) :if-does-not-exist nil)
271               (when stream
272                 (load-as-source stream :context context))))))))
273
274 (defun process-eval/load-options (options)
275   (/show0 "handling --eval and --load options")
276   (flet ((process-1 (cons)
277            (destructuring-bind (opt . value) cons
278              (ecase opt
279                (:eval
280                 (with-simple-restart (continue "Ignore runtime option --eval ~S."
281                                                value)
282                   (multiple-value-bind (expr pos) (read-from-string value)
283                     (if (eq value (read-from-string value nil value :start pos))
284                         (eval expr)
285                         (error "Multiple expressions in --eval option: ~S"
286                                value)))))
287                (:load
288                 (with-simple-restart (continue "Ignore runtime option --load ~S."
289                                                value)
290                   (load (native-pathname value))))))
291            (flush-standard-output-streams)))
292     (with-simple-restart (abort "Skip rest of --eval and --load options.")
293       (dolist (option options)
294         (process-1 option)))))
295
296 (defun process-script (script)
297   (flet ((load-script (stream)
298            ;; Scripts don't need to be stylish or fast, but silence is usually a
299            ;; desirable quality...
300            (handler-bind (((or style-warning compiler-note) #'muffle-warning)
301                           (stream-error (lambda (e)
302                                           ;; Shell-style.
303                                           (when (member (stream-error-stream e)
304                                                         (list *stdout* *stdin* *stderr*))
305                                             (quit)))))
306              ;; Let's not use the *TTY* for scripts, ok? Also, normally we use
307              ;; synonym streams, but in order to have the broken pipe/eof error
308              ;; handling right we want to bind them for scripts.
309              (let ((*terminal-io* (make-two-way-stream *stdin* *stdout*))
310                    (*debug-io* (make-two-way-stream *stdin* *stderr*))
311                    (*standard-input* *stdin*)
312                    (*standard-output* *stdout*)
313                    (*error-output* *stderr*))
314                (load stream :verbose nil :print nil)))))
315     (handling-end-of-the-world
316       (if (eq t script)
317           (load-script *stdin*)
318           (with-open-file (f (native-pathname script) :element-type :default)
319             (sb!fasl::maybe-skip-shebang-line f)
320             (load-script f))))))
321
322 ;; Errors while processing the command line cause the system to QUIT,
323 ;; instead of trying to go into the Lisp debugger, because trying to
324 ;; go into the Lisp debugger would get into various annoying issues of
325 ;; where we should go after the user tries to return from the
326 ;; debugger.
327 (defun startup-error (control-string &rest args)
328   (format *error-output*
329           "fatal error before reaching READ-EVAL-PRINT loop: ~%  ~?~%"
330           control-string
331           args)
332   (quit :unix-status 1))
333
334 ;;; the default system top level function
335 (defun toplevel-init ()
336   (/show0 "entering TOPLEVEL-INIT")
337   (let ( ;; value of --sysinit option
338         (sysinit nil)
339         ;; t if --no-sysinit option given
340         (no-sysinit nil)
341         ;; value of --userinit option
342         (userinit nil)
343         ;; t if --no-userinit option given
344         (no-userinit nil)
345         ;; t if --disable-debugger option given
346         (disable-debugger nil)
347         ;; list of (<kind> . <string>) conses representing --eval and --load
348         ;; options. options. --eval options are stored as strings, so that
349         ;; they can be passed to READ only after their predecessors have been
350         ;; EVALed, so that things work when e.g. REQUIRE in one EVAL form
351         ;; creates a package referred to in the next EVAL form. Storing the
352         ;; original string also makes for easier debugging.
353         (reversed-options nil)
354         ;; Has a --noprint option been seen?
355         (noprint nil)
356         ;; Has a --script option been seen?
357         (script nil)
358         ;; everything in *POSIX-ARGV* except for argv[0]=programname
359         (options (rest *posix-argv*)))
360
361     (declare (type list options))
362
363     (/show0 "done with outer LET in TOPLEVEL-INIT")
364
365     ;; FIXME: There are lots of ways for errors to happen around here
366     ;; (e.g. bad command line syntax, or READ-ERROR while trying to
367     ;; READ an --eval string). Make sure that they're handled
368     ;; reasonably.
369
370     ;; Process command line options.
371     (loop while options do
372          (/show0 "at head of LOOP WHILE OPTIONS DO in TOPLEVEL-INIT")
373          (let ((option (first options)))
374            (flet ((pop-option ()
375                     (if options
376                         (pop options)
377                         (startup-error
378                          "unexpected end of command line options"))))
379              (cond ((string= option "--script")
380                     (pop-option)
381                     (setf disable-debugger t
382                           no-userinit t
383                           no-sysinit t
384                           script (if options (pop-option) t))
385                     (return))
386                    ((string= option "--sysinit")
387                     (pop-option)
388                     (if sysinit
389                         (startup-error "multiple --sysinit options")
390                         (setf sysinit (pop-option))))
391                    ((string= option "--no-sysinit")
392                     (pop-option)
393                     (setf no-sysinit t))
394                    ((string= option "--userinit")
395                     (pop-option)
396                     (if userinit
397                         (startup-error "multiple --userinit options")
398                         (setf userinit (pop-option))))
399                    ((string= option "--no-userinit")
400                     (pop-option)
401                     (setf no-userinit t))
402                    ((string= option "--eval")
403                     (pop-option)
404                     (push (cons :eval (pop-option)) reversed-options))
405                    ((string= option "--load")
406                     (pop-option)
407                     (push (cons :load (pop-option)) reversed-options))
408                    ((string= option "--noprint")
409                     (pop-option)
410                     (setf noprint t))
411                    ((string= option "--disable-debugger")
412                     (pop-option)
413                     (setf disable-debugger t))
414                    ((string= option "--end-toplevel-options")
415                     (pop-option)
416                     (return))
417                    (t
418                     ;; Anything we don't recognize as a toplevel
419                     ;; option must be the start of user-level
420                     ;; options.. except that if we encounter
421                     ;; "--end-toplevel-options" after we gave up
422                     ;; because we didn't recognize an option as a
423                     ;; toplevel option, then the option we gave up on
424                     ;; must have been an error. (E.g. in
425                     ;;  "sbcl --eval '(a)' --eval'(b)' --end-toplevel-options"
426                     ;; this test will let us detect that the string
427                     ;; "--eval(b)" is an error.)
428                     (if (find "--end-toplevel-options" options
429                               :test #'string=)
430                         (startup-error "bad toplevel option: ~S"
431                                        (first options))
432                         (return)))))))
433     (/show0 "done with LOOP WHILE OPTIONS DO in TOPLEVEL-INIT")
434
435     ;; Delete all the options that we processed, so that only
436     ;; user-level options are left visible to user code.
437     (setf (rest *posix-argv*) options)
438
439     ;; Disable debugger before processing initialization files & co.
440     (when disable-debugger
441       (sb!ext:disable-debugger))
442
443     ;; Handle initialization files.
444     (/show0 "handling initialization files in TOPLEVEL-INIT")
445     ;; This CATCH is needed for the debugger command TOPLEVEL to
446     ;; work.
447     (catch 'toplevel-catcher
448       ;; We wrap all the pre-REPL user/system customized startup
449       ;; code in a restart.
450       ;;
451       ;; (Why not wrap everything, even the stuff above, in this
452       ;; restart? Errors above here are basically command line
453       ;; or Unix environment errors, e.g. a missing file or a
454       ;; typo on the Unix command line, and you don't need to
455       ;; get into Lisp to debug them, you should just start over
456       ;; and do it right at the Unix level. Errors below here
457       ;; are generally errors in user Lisp code, and it might be
458       ;; helpful to let the user reach the REPL in order to help
459       ;; figure out what's going on.)
460       (restart-case
461           (progn
462             (unless no-sysinit
463               (process-init-file sysinit :system))
464             (unless no-userinit
465               (process-init-file userinit :user))
466             (process-eval/load-options (nreverse reversed-options))
467             (when script
468               (process-script script)
469               (bug "PROCESS-SCRIPT returned")))
470         (abort ()
471           :report (lambda (s)
472                     (write-string
473                      (if script
474                          ;; In case script calls (enable-debugger)!
475                          "Abort script, exiting lisp."
476                          "Skip to toplevel READ/EVAL/PRINT loop.")
477                      s))
478           (/show0 "CONTINUEing from pre-REPL RESTART-CASE")
479           (values))                     ; (no-op, just fall through)
480         (quit ()
481           :report "Quit SBCL (calling #'QUIT, killing the process)."
482           :test (lambda (c) (declare (ignore c)) (not script))
483           (/show0 "falling through to QUIT from pre-REPL RESTART-CASE")
484           (quit :unix-status 1))))
485
486     ;; one more time for good measure, in case we fell out of the
487     ;; RESTART-CASE above before one of the flushes in the ordinary
488     ;; flow of control had a chance to operate
489     (flush-standard-output-streams)
490
491     (/show0 "falling into TOPLEVEL-REPL from TOPLEVEL-INIT")
492     (toplevel-repl noprint)
493     ;; (classic CMU CL error message: "You're certainly a clever child.":-)
494     (critically-unreachable "after TOPLEVEL-REPL")))
495
496 ;;; hooks to support customized toplevels like ACL-style toplevel from
497 ;;; KMR on sbcl-devel 2002-12-21.  Altered by CSR 2003-11-16 for
498 ;;; threaded operation: altered *REPL-FUN* to *REPL-FUN-GENERATOR*.
499 (defvar *repl-read-form-fun* #'repl-read-form-fun
500   #!+sb-doc
501   "A function of two stream arguments IN and OUT for the toplevel REPL to
502 call: Return the next Lisp form to evaluate (possibly handling other magic --
503 like ACL-style keyword commands -- which precede the next Lisp form). The OUT
504 stream is there to support magic which requires issuing new prompts.")
505 (defvar *repl-prompt-fun* #'repl-prompt-fun
506   #!+sb-doc
507   "A function of one argument STREAM for the toplevel REPL to call: Prompt
508 the user for input.")
509 (defvar *repl-fun-generator* (constantly #'repl-fun)
510   #!+sb-doc
511   "A function of no arguments returning a function of one argument NOPRINT
512 that provides the REPL for the system. Assumes that *STANDARD-INPUT* and
513 *STANDARD-OUTPUT* are set up.")
514
515 ;;; read-eval-print loop for the default system toplevel
516 (defun toplevel-repl (noprint)
517   (/show0 "entering TOPLEVEL-REPL")
518   (let ((* nil) (** nil) (*** nil)
519         (- nil)
520         (+ nil) (++ nil) (+++ nil)
521         (/// nil) (// nil) (/ nil))
522     (/show0 "about to funcall *REPL-FUN-GENERATOR*")
523     (let ((repl-fun (funcall *repl-fun-generator*)))
524       ;; Each REPL in a multithreaded world should have bindings of
525       ;; most CL specials (most critically *PACKAGE*).
526       (with-rebound-io-syntax
527           (handler-bind ((step-condition 'invoke-stepper))
528             (loop
529                (/show0 "about to set up restarts in TOPLEVEL-REPL")
530                ;; CLHS recommends that there should always be an
531                ;; ABORT restart; we have this one here, and one per
532                ;; debugger level.
533                (with-simple-restart
534                    (abort "~@<Exit debugger, returning to top level.~@:>")
535                  (catch 'toplevel-catcher
536                    ;; In the event of a control-stack-exhausted-error, we
537                    ;; should have unwound enough stack by the time we get
538                    ;; here that this is now possible.
539                    #!-win32
540                    (sb!kernel::reset-control-stack-guard-page)
541                    (funcall repl-fun noprint)
542                    (critically-unreachable "after REPL")))))))))
543
544 ;;; Our default REPL prompt is the minimal traditional one.
545 (defun repl-prompt-fun (stream)
546   (fresh-line stream)
547   (write-string "* " stream)) ; arbitrary but customary REPL prompt
548
549 ;;; Our default form reader does relatively little magic, but does
550 ;;; handle the Unix-style EOF-is-end-of-process convention.
551 (defun repl-read-form-fun (in out)
552   (declare (type stream in out) (ignore out))
553   ;; KLUDGE: *READ-SUPPRESS* makes the REPL useless, and cannot be
554   ;; recovered from -- flip it here.
555   (when *read-suppress*
556     (warn "Setting *READ-SUPPRESS* to NIL to restore toplevel usability.")
557     (setf *read-suppress* nil))
558   (let* ((eof-marker (cons nil nil))
559          (form (read in nil eof-marker)))
560     (if (eq form eof-marker)
561         (quit)
562         form)))
563
564 (defun repl-fun (noprint)
565   (/show0 "entering REPL")
566   (loop
567    (unwind-protect
568         (progn
569           ;; (See comment preceding the definition of SCRUB-CONTROL-STACK.)
570           (scrub-control-stack)
571           (sb!thread::get-foreground)
572           (unless noprint
573             (flush-standard-output-streams)
574             (funcall *repl-prompt-fun* *standard-output*)
575             ;; (Should *REPL-PROMPT-FUN* be responsible for doing its own
576             ;; FORCE-OUTPUT? I can't imagine a valid reason for it not to
577             ;; be done here, so leaving it up to *REPL-PROMPT-FUN* seems
578             ;; odd. But maybe there *is* a valid reason in some
579             ;; circumstances? perhaps some deadlock issue when being driven
580             ;; by another process or something...)
581             (force-output *standard-output*))
582           (let* ((form (funcall *repl-read-form-fun*
583                                 *standard-input*
584                                 *standard-output*))
585                  (results (multiple-value-list (interactive-eval form))))
586             (unless noprint
587               (dolist (result results)
588                 (fresh-line)
589                 (prin1 result)))))
590      ;; If we started stepping in the debugger we want to stop now.
591      (disable-stepping))))
592 \f
593 ;;; a convenient way to get into the assembly-level debugger
594 (defun %halt ()
595   (%primitive sb!c:halt))