Changeset 5976


Ignore:
Timestamp:
Mar 2, 2007, 4:08:05 AM (18 years ago)
Author:
Gary Byers
Message:

Don't call QUIT on EOF, call EXIT-INTERACTIVE-PROCESS instead.

Look at *QUIT-ON-EOF* when deciding what to do in response to EOF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-readloop-lds.lisp

    r5325 r5976  
    192192          (return t))))))
    193193
     194(defparameter *quit-on-eof* nil)
     195
    194196;;; This is the part common to toplevel loop and inner break loops.
    195197(defun read-loop (&key (break-level *break-level*)
     
    206208    (loop
    207209      (restart-case
    208         (catch :abort ;last resort...
    209           (loop
    210             (catch-cancel
    211               (loop               
    212                 (setq *in-read-loop* nil
    213                       *break-level* break-level)
    214                 (multiple-value-bind (form path print-result)
    215                     (toplevel-read :input-stream input-stream
    216                                    :output-stream output-stream
    217                                    :prompt-function prompt-function
    218                                    :eof-value eof-value)
    219                   (if (eq form eof-value)
    220                     (if (and (not *batch-flag*)
    221                              (eof-transient-p (stream-device input-stream :input)))
    222                       (progn
    223                         (stream-clear-input input-stream)
    224                         (abort-break))
    225                       (quit))
    226                     (or (check-toplevel-command form)
    227                         (let* ((values (toplevel-eval form path)))
     210       (catch :abort                    ;last resort...
     211         (loop
     212           (catch-cancel
     213            (loop               
     214              (setq *in-read-loop* nil
     215                    *break-level* break-level)
     216              (multiple-value-bind (form path print-result)
     217                  (toplevel-read :input-stream input-stream
     218                                 :output-stream output-stream
     219                                 :prompt-function prompt-function
     220                                 :eof-value eof-value)
     221                (if (eq form eof-value)
     222                  (if (and (not *batch-flag*)
     223                           (not *quit-on-eof*)
     224                           (eof-transient-p (stream-device input-stream :input)))
     225                    (progn
     226                      (stream-clear-input input-stream)
     227                      (abort-break))
     228                    (exit-interactive-process *current-process*))
     229                  (or (check-toplevel-command form)
     230                      (let* ((values (toplevel-eval form path)))
    228231                        (if print-result (toplevel-print values))))))))
    229             (format *terminal-io* "~&Cancelled")))
    230         (abort () :report (lambda (stream)
    231                             (if (eq break-level 0)
    232                               (format stream "Return to toplevel.")
    233                               (format stream "Return to break level ~D." break-level)))
    234                #| ; Handled by interactive-abort
    235                 ; go up one more if abort occurred while awaiting/reading input               
    236                 (when (and *in-read-loop* (neq break-level 0))
    237                   (abort))
    238                 |#
     232           (format *terminal-io* "~&Cancelled")))
     233       (abort () :report (lambda (stream)
     234                           (if (eq break-level 0)
     235                             (format stream "Return to toplevel.")
     236                             (format stream "Return to break level ~D." break-level)))
     237              #|                        ; Handled by interactive-abort
     238                                        ; go up one more if abort occurred while awaiting/reading input               
     239              (when (and *in-read-loop* (neq break-level 0))
     240              (abort))
     241              |#
    239242               )
    240243        (abort-break ()
Note: See TracChangeset for help on using the changeset viewer.