[comp.lang.ada] Handling Interactive Input from the Keyboard Buffer

asheem@mandrill (Asheem Chandna) (04/08/88)

Hi,

   I was wondering if anyone has a working solution, or can perhaps give me a
few pointers, on handling interactive input from the keyboard buffer during
program runs.

   I have a large simulation program with many tasks in it. During every time
loop, I want to do a check to see if the user has typed anything from the 
keyboard. If he (or she) has, then I want to pull up the user menu. If he
hasn't, then I just want the program to continue WITHOUT waiting for user
input. Since, I'd like to do this every time loop, I'm also looking for a low
overhead way to do it (for e.g., I'd rather not have a delay based time-out on
every loop). So, basically, I'm looking for an elegant way to have the user 
interrupt a program run. 

   Currently, I have a solution which basically uses Asynchronous System Traps
(ASTs) on Digitals VAX/VMS system. If the user types a certain control
sequence, then using ASTs, an entry call is issued to the specified task within
the Ada simulation program. On every loop, that task simply checks the 
entry'count to see if the user wants to interrupt the program. While this 
solution works, I'd like to use an approach that is simpler, and more portable.

Any help will be greatly appreciated.
Thanks in advance!

Asheem Chandna

Center for Automation &			
Intelligent Systems Research		
Case Western Reserve University
(216)-368-5118
asheem@mandrill.cwru.edu  (asheem@129.22.16.1)
...!{cbosgd,decvax,sun}!mandrill!asheem