[comp.os.vms] SMG$READ_KEYSTROKE

tjp@PHOBOS.CALTECH.EDU (Tim Pearson) (02/01/88)

The SMG$READ_KEYSTROKE procedure (in VMS v4.4) does not recognise
control sequences generated by a VT200-series terminal set to "VT200
mode, 8-bit Controls"; it returns code 511 (unknown terminator) for
the arrow keys and keypad keys.  Does anyone know if this behavior is 
documented anywhere, or if 8-bit controls are (or will be) supported by 
a later version of VMS?

[The following trivial program demonstrates the problem; it just types 
the code returned by SMG$READ_KEYSTROKE for each key you type.]

	integer ier, id, key
	integer smg$create_virtual_keyboard
	integer smg$read_keystroke
	ier = smg$create_virtual_keyboard(id,'SYS$COMMAND')
	if (ier.ne.1) callexit(ier)
10	ier = smg$read_keystroke(id,key)
	if (ier.ne.1) callexit(ier)
	type *,key
	goto 10
	end

Tim Pearson, Astronomy Dept, Caltech, Pasadena, California 91125, USA
BITNET/EARN:               tjp@citphobo
SPAN/HEPNet/Caltech:       Phobos::TJP or 6020::TJP
Internet:                  TJP%Phobos@Hamlet.Caltech.Edu
Telephone:                 +1 818 356-4980

-------

LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) (02/08/88)

	The SMG$READ_KEYSTROKE procedure (in VMS v4.4) does not recognise
	control sequences generated by a VT200-series terminal set to "VT200
	mode, 8-bit Controls"; it returns code 511 (unknown terminator) for
	the arrow keys and keypad keys.  Does anyone know if this behavior is
	documented anywhere, or if 8-bit controls are (or will be) supported
	by  a later version of VMS?

This is a restriction - it's documented SOMEWHERE (perhaps in the V4.2
release notes) - but I can't really point you to it.

The basic problem is simple:  SMG has no mechanism for specifying that two
different incoming sequences map to the same character.  Depending on whether
the terminal is set to 8-bit or 7-bit controls, a key like Select can send
either ESC [ 4 ~ or CSI 4 ~.  Now, ESC [ and CSI "mean the same thing", but
SMG has no way to specify THAT transformation either.

The standard terminal definitions are set up assuming 7-bit controls, so
8-bit controls aren't recognized.  I've never tried this, but you could
probably set up a definition for a VT200_8 terminal, which was identical to
that for a VT200 but defined the keys in terms of the 8-bit controls.  Of
course, then the 7-bit controls wouldn't work.

This limitation is not removed in V4.6 or, I'm 99+% certain, in V4.7.  Maybe
in V5?

In the meantime, the gain from using 8-bit controls is pretty minor.  (It's
important to realize that even if the terminal is set for 7-bit controls, it
will still RECOGNIZE 8-bit controls.  Since traffic TO the terminal is much
heavier than traffic FROM it, most of the available savings from using 8-bit
controls is there whether the terminal SENDS them or not.)

							-- Jerry