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

buffered output and prompting

    Date: Wednesday, 19 February 1986  13:10-EST
    To:   common-lisp at SU-AI.ARPA
    Re:   buffered output and prompting

    I'm having trouble coming up with a portable way for a CL application
    program to read with a prompt string.  What I would like to do is
    something like, but more general than, the y-or-n-p and yes-or-no-p
    functions: specify a prompt string and then call read, read-line, or
    read-char.  For a usual terminal-style interaction, I'd like to have
    the prompt message printed out without a newline so the cursor is left
    at the end of the same line, and then read.

I believe the solution in TOPS-20 Clisp is the have the terminal
output stream remember the text on the current line.  When a read is
done on the stream, this text is passed to the OS prompting call as
the prompt.

I think it is definitely wrong for a FORCE-OUTPUT or FINISH-OUTPUT to
implicitly cause a newline to be written.  If it is impossible to
write text without a newline, then these calls are probably no-ops in
your OS.

It isn't true that the Common Lisp I/O precludes the use of a pop-up
window for prompting.  All you have to do is define the stream so that
it pops up when you use it.  You can do quite a bit with the built-in
stream I/O functions if you are willing to define new kinds of
streams.  Common Lisp doesn't specifiy how, but every implementation
should provide some way to define new kinds of streams in Lisp.