[Openmcl-devel] Two streams questions
Ron Garret
ron at flownet.com
Fri Jul 29 16:43:30 PDT 2016
On Jul 29, 2016, at 3:42 PM, Gary Byers <gb at clozure.com> wrote:
> I have not tried this, looked at the code, or thought about this much,
>
> Does
>
> (defun read-byte-no-hang (s)
> (when (listen s)
> (read-byte s)))
>
> work ?
Unfortunately, no. CLHS specifically says:
"On a non-interactive input-stream, listen returns true except when at end of file[1]”
(IMHO this is a bug in the spec.)
> Note also that a terminal device may be in one of a few "modes: (raw, cooked, cbreak) some of which may do line bufferimg (aka "rubout handling") inside the tty driver.
Yes, this one is in raw mode. I’ve been able to get this to work by using a character stream with a latin-1 encoding and read-char-no-hang, but that’s a horrible hack.
rg
More information about the Openmcl-devel
mailing list