[comp.os.vms] Pascal keyboard interrupt

LEWIS@GRIN1.BITNET ("Pat ", Lewis,Pat J) (02/10/88)

Someone asked about doing single key input in Pascal: Well, we have Oregon
Pascal Version 2.1I, so I don't know how applicable this will be to your
version of Pascal (most other sites have VAX Pascal), but what I do is
this:

Somewhere in the beginning of your program's main body, have the statement

Reset (input, 'TT:/RAL/SINGLE/NOECHO');

This resets the terminal input; the /RAL switch means Read All or something
like that, it prevents translation of non-printable ASCII into spaces; the
/SINGLE switch sets the input buffer to one character, so that you can do
things like

Read (Ch);

where Ch is a char var, in this way you get input without waiting for the
user to type a RETURN to flush the input buffer; the /NOECHO switch is
optional, and sets the terminal to noecho so that you can interpret escape
sequences sent by the keypad without having them echo.  (this switch is of
course optional).

The only problems with this method is that you will have to have a
statement like

Write (chr (27), "=");

following the reset if you wish to use ANSI escape sequences; for some
reason the Reset blasts you back to VT52 mode.  The other problem is that
you cannot now do things like read in string or integer variables; you will
have to write your own procedures to do these functions.  Also, single
character input like this purportedly invokes the monitor and so is
evidently a real drain on CPU time.

Hope that helps.

                                        Pat Lewis
                                        Grinnell College User Consultant
                                        LEWIS@GRIN1.BITNET