[comp.os.vms] Reading Single Keystrokes - How Do I Cope With PF Keys? Summary

cameron@runx.ips.oz (James Cameron) (05/18/88)

Summary of responses to  my  query  concerning  single  keystroke
reading from SYS$INPUT;

My thanks to the ten people who replied. Your replies were highly
valued.

All of you were up the wrong track. I need an I/O that will  work
asynchronously,  that is, the program must not wait at that point
for a keystroke. The $QIO I was using achieved this. It specified
an  AST  routine that would interrupt the main program to process
the keystroke. The  main  program  is  responsible  for  periodic
screen updates.

All of you were up the wrong track because  you  suggested  using
SMG$READ_KEYSTROKE alone, which does not work asynchronously.

In the end, a solution was to use SMG$ENABLE_UNSOLICITED_INPUT to
trigger  an  AST  routine which would issue an SMG$READ_KEYSTROKE
with a timeout value of zero. This works  like  this;  when  user
presses  a  key,  the sequence of characters ends up in the type-
ahead buffer. The mailbox associated with the  terminal  (created
by  SMG$ENABLE_UNSOLICITED_INPUT)  receives  an  unsolicited data
message and calls the AST routine that I specified. The AST  rou-
tine  issues  the SMG$READ_KEYSTROKE and processes the input. The
AST routine repeats the SMG$READ_KEYSTROKE and  processing  until
it  gets  a time-out status. It then returns (to whatever was in-
terrupted).

The problem now, is that the program seems to go-silent  (at  AST
level)  when  lots  of  keys  are pressed. I'm still looking into
that, so don't suggest anything yet.

This still does not resolve the worry I had. Here's  part  of  my
original message...

	"I thought that I could use an unsolicited data mailbox. When the
	program receives the unsolicited data message, it would issue the
	$QIO to the terminal with a timeout value of zero, thus  catching
	either  a  single character that the user typed or the escape se-
	quence But I have a worry about that - if the  terminal  line  is
	low  speed,  or a multiplexor causes the subsequent characters of
	an escape sequence to arrive a bit later, will this cause the I/O
	to  only pick up the first few characters of the sequence? Does a
	read with timeout of zero only read  the  type-ahead  buffer?  Or
	does  it  wait to see an entire escape sequence if it has noticed
	an escape character?"

I would appreciate any comments or help. Please reply by MAIL.

James Cameron, Kilpatrick Green Pty. Ltd., P.O. Box N366, Sydney 2000 Australia
Internet: cameron@runx.ips.oz.au  UUCP: uunet!runx.ips.oz.au!cameron