[Openmcl-devel] CCL, ncurses, and raw mode

R. Matthew Emerson rme at acm.org
Mon Mar 12 11:55:44 PDT 2018

> On Mar 12, 2018, at 11:15 AM, Ron Garret <ron at flownet.com> wrote:
> I’m trying to use libncurses in ccl and it’s mostly working, except that I can’t turn on raw mode i.e. the mode where ctrl-C and ctrl-Z are delivered to the Lisp process as normal characters rather than as OS signals.  I can get this to work in C so I know that libncurses is doing the right thing.  Do any of you CCL-internals gurus have any idea what CCL is doing to thwart raw mode, and what I can do to unthwart it?
> (I’m not posting code because my current code has a ton of dependencies and creating a standalone demo of the problem would be a fair amount of work, so I thought I’d start by seeing if anyone just knows the answer offhand.)

I don't recall anything in CCL itself that would be preventing you from putting the tty into raw mode.

There's some code in ccl:library;pty.lisp to manipulate tty modes, and it might be worth a look.  Here's a brief example:

$ ccl
Clozure Common Lisp Version 1.11.5/v1.11.5  (DarwinX8664)
? (require 'pty)
? (ccl::set-tty-raw 0)

;;; here I type "(read-char)" (without pressing return), and then
;;; type ctrl-C


Normally you'd wrap the usage of raw mode by saving/restoring the tty modes via #_tcgetattr/#_tcsetattr.

Typing "stty sane" followed by ctrl-J will make your terminal somewhat usable again after leaving it in raw mode.

More information about the Openmcl-devel mailing list