mit-scheme-devel
[Top][All Lists]
Advanced

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

Re: [MIT-Scheme-devel] Forcing (read) to read a given character from the


From: Derek Peschel
Subject: Re: [MIT-Scheme-devel] Forcing (read) to read a given character from the terminal once?
Date: Fri, 13 Nov 2009 13:40:03 -0800
User-agent: Mutt/1.2.5.1i

On Sun, Oct 18, 2009 at 09:24:58PM -0400, Taylor R Campbell wrote:
> You can enter an ordinary REPL, in the debugger frame's environment,
> with the `e' command.

Yes, but if the debugger could offer REPL and debug features at the same
time, then "e" would become unnecessary except perhaps in case of debugger
errors.  Basically I'm saying that the abstractions and tools MIT Scheme
provides are useful but the keystrokes to use them may be able to be
improved.

> Once control enters the reader, killing the line may prove tricky.
> When interacting with the usual REPL, the only way one can kill a line
> is by talking with the terminal before the line gets to Scheme.

Talking with the terminal is fine.  What I meant is that the terminal kill
character should also kill the parenthesis.  In order for that to happen,
the parenthesis must be echoed after the prompt and the TTY driver must
know the parenthesis was echoed.  Currently in (%prompt-for-expression):

  - the output half of the terminal is put into cooked mode
  - the prompt is printed
  - the input half of the terminal is put into cooked mode
  - (read) is called

I just wrote a debugger command that does the unread-char, and that part
works fine.  The reader sees the parenthesis.  Doing the unread-char doesn't
cause any echo, however, so unread-char isn't the solution by itself.

In OS X, there's an ioctl called TIOCSTI, "simulate typed input".  In a
little C test program I wrote, in cooked mode the ioctl echos whatever
character you want and puts it into the TTY driver's input line for erase,
kill, and word-erase to work on.  That's the operation I need, but the MIT
Scheme microcode doesn't know about TIOCSTI yet.

-- Derek




reply via email to

[Prev in Thread] Current Thread [Next in Thread]