Differences in Checking Keystroke Availability

Terminal-based systems do not provide a standard means of checking the terminal's keyboard buffer for an available keystroke; thus, it is not possible to fully implement the Vermont Views function ki_chk(), or its derivative ki_same(), under standard terminal-based operating systems.

ki_chk() is implemented in each terminal-based operating system as follows:

UNIX

Although the keyboard buffer cannot be checked directly, UNIX does allow checking of the keyboard buffer associated with the standard input stdin. We implement ki_chk() by setting input to non-blocking and then attempting to read a character. If we don't get a character, by definition, none are available. Before returning, we restore input back to blocking if this was the state it originally was.

The stdin buffer will not always contain all keystrokes that have been entered. At any given moment, some keystrokes in the terminal's keyboard buffer may not yet have been transferred to the stdin buffer. Therefore, ki_same() may not retrieve all available keystrokes in one call. In most uses of the keyboard functions within Vermont Views, the difference from a full implementation of ki_chk() will not be noticeable.

VMS

Although the terminal's keyboard buffer cannot be checked directly, the input buffer maintained by VMS can be checked. ki_chk() tests whether any keystrokes are available in the input buffer. This buffer will not always contain all keystrokes that have been entered. At any given moment, some keystrokes in the terminal's keyboard buffer may not yet have been transferred to the buffer. Therefore, ki_same() may not retrieve all available keystrokes in one call. In most uses of the keyboard functions within Vermont Views, the difference from a full implementation of ki_chk() will not be noticeable.

XENIX

Under XENIX, ki_chk() can be implemented completely for the console. Refer to the function rd_chk() in the PC/XENIX Software Command Reference Manual for complete information.


Home Contents Previous Next