[Openmcl-devel] Quick Query...
gb at clozure.com
Thu Nov 11 09:55:14 EST 2004
On Thu, 11 Nov 2004, Doug Philips wrote:
> Hey all,
> I'm at a loss for where to look to find out
> how I can do non-blocking I/O, esp. how I can put "stdin" (the keyboard) into unbuffered/raw
> mode (from the command line, I'm not interested in writing GUI code, just not having to wait for a return/enter to get character input)... having grunged over the docs and having been unable to formulate a google query with useful results... Can anyone give me a quick URL, pointer, ?
There's some code for manipulating TTY modes in "ccl:library;pty.lisp".
? (require "PTY")
? (ccl::disable-tty-local-modes 0 #$ICANON)
will turn off "input canonicalization" on file descriptor 0, which is
at least part of what you need to do here. (That basically turns off
the line-buffering/line-editing that the OS does.)
(Of course, that only has an effect if the file descriptor is a TTY/PTY
If the #$ICANON mode is disabled, you can do things like:
? (progn (read-char) (read-char))
(where the first READ-CHAR consumes the newline, which isn't really
necessary to make the reader happy anymore.) So, you can do:
(where there's a space after the close-paren) without having to type
More information about the Openmcl-devel