[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modification to LISTEN



I would like to have LISTEN return two values.  The first value is the same as
it is now and the second value is true if end of file is encountered.  The
new definition allows READ-CHAR-NO-HANG to be implemented using only READ-CHAR
and LISTEN.

    (defun read-char-no-hang (&optional input-stream eof-error-p eof-value
                                        recursive-p)
      (multiple-value-bind (char-available-p eof-encountered-p)
                           (listen input-stream)
        (cond (char-available-p
                (read-char input-stream eof-error-p eof-value recursive-p))
              (eof-encountered-p
                (if eof-error-p (error ...) eof-value)))))