Common Lisp Package: TRIVIAL-RAW-IO

README:

trivial-raw-io

For all your portable CL raw POSIX I/O needs! We export three simple symbols: with-raw-io, read-char, and read-line.

Obviously, read-char and read-line shadow the existing CL symbols. We simply call them inside with-raw-io.

with-raw-io is a macro which takes a (ENTITY &) and executes BODY with IO in non-canonical mode by modifying POSIX termios settings, then restores the previous settings.

At this time, trivial-raw-io has been tested on: SBCL, CCL, CMUCL, and CLISP. All testing has been done on Linux.

FUNCTION

Public

READ-CHAR (&OPTIONAL (STREAM *QUERY-IO*) (EOF-ERROR-P T) EOF-VALUE RECURSIVE-P)

Read a single character without echoing it from stream STREAM.

READ-LINE (&OPTIONAL (STREAM *QUERY-IO*) (EOF-ERROR-P T) EOF-VALUE RECURSIVE-P)

Read a line without echoing it from stream STREAM.

MACRO

Public

WITH-RAW-IO ((&KEY (VMIN 1) (VTIME 0)) &BODY BODY)

Execute BODY without echoing input IO actions.

Private

WITH-GENSYMS (NAMES &BODY FORMS)

Binds each variable named by a symbol in NAMES to a unique symbol around FORMS. Each of NAMES must either be either a symbol, or of the form: (symbol string-designator) Bare symbols appearing in NAMES are equivalent to: (symbol symbol) The string-designator is used as the argument to GENSYM when constructing the unique symbol the named variable will be bound to.