Kaz Kylheku <
k...@kylheku.com> wrote:
+---------------
| grobibi <
tristanh...@free.fr> wrote:
| > How can I modify the behaviour of sbcl or clisp, for exemple,
| > to "respond immediatly" as mentionned above?
|
| On what platform? If the input stream is connected to a Unix TTY,
| and that TTY is in canonical input processing mode, then the only
| way to fix it is to change the TTY operation with tcgetattr/tcsetattr:
| either directly yourself via FFI, or through some library function
| provided by the Lisp implementation for switching to a raw input.
+---------------
Indeed. SBCL and CMUCL can do this via their "alien" facility,
executing "tcgetattr/tcsetattr" more-or-less directly. In CMUCL,
see UNIX:UNIX-TCGETATTR and UNIX:UNIX-TCSETATTR. [Note: A fairly
clean implementation of a READ-CHAR-NO-ECHO-CBREAK (several years
ago) took me ~15 lines of CL code.] In SBCL, the package [and
perhaps the symbol names] will be different, but equivalent
functions should be available.
And as Pascal B. already noted in a parallel reply, CLISP can
do this through its SCREEN:WITH-WINDOW and EXT:WITH-KEYBOARD
facilities on both Unix/Linux and MS Windows, see:
http://www.clisp.org/impnotes.html#screen
http://www.clisp.org/impnotes.html#with-kbd
To reinforce what Kaz said, doing this sort of stuff is *very*
platform- and CL implementation-dependent! You have been warned. ;-}
-Rob
p.s. For comparison, this is (roughly) what the FreeBSD "less"
program [in C] does to get into cbreak mode on the terminal,
where "s" is a "struct termios":
s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL);
s.c_oflag |= (OPOST|ONLCR|TAB3);
s.c_oflag &= ~(OCRNL|ONOCR|ONLRET);
s.c_cc[VMIN] = 1;
s.c_cc[VTIME] = 0;
You need to save & restore the old values around the read of
the character, of course...
-----
Rob Warnock <
rp...@rpw3.org>
627 26th Avenue <
http://rpw3.org/>
San Mateo, CA 94403