* Unbuffered keyboard input on VAX ADA?
@ 1995-01-27 7:05 Jake E. Hamby
0 siblings, 0 replies; 3+ messages in thread
From: Jake E. Hamby @ 1995-01-27 7:05 UTC (permalink / raw)
Does anyone know a way to get unbuffered keyboard input (i.e. one
character at a time without waiting for ENTER) using DEC Ada 83 for
VAX/VMS? Our curriculum at Cal Poly Pomona uses Ada, and NONE of the
students/faculty has found an answer to this seemingly simple problem.
Perhaps it's possible to import a foreign C function to do the input, but
I would like to have an Ada-only solution. Does anyone know how to do
this? Please send E-Mail, I will post a reply. Thanks in advance!
--
=========================================================================
* Jake Hamby - "Linux: The Choice of a GNU Generation" *
* E-MAIL: jehamby@lightside.com + jehamby@vms4.sci.csupomona.edu *
* http://vms4.sci.csupomona.edu/~jehamby/index.html *
^ permalink raw reply [flat|nested] 3+ messages in thread
* Unbuffered keyboard input on VAX ADA?
@ 1995-02-02 0:40 Jake E. Hamby
[not found] ` <1995Feb3.103003.9017@eisner>
0 siblings, 1 reply; 3+ messages in thread
From: Jake E. Hamby @ 1995-02-02 0:40 UTC (permalink / raw)
Okay, thanks for all the responses I got. Basically, everyone used the
same low-level VMS system calls from packages STARLET and SYSTEM to read
the input, so the programs all looked pretty much identical. By the
way, Ada 9X has the Get_Immediate procedure in TEXT_IO, but of course
VAX Ada is only Ada 83, so it has to resort to such a kludge. Here is the
example written by jrg@sema-grenoble.fr:
with SYSTEM;
with TEXT_IO;
with CONDITION_HANDLING;
with STARLET;
with TASKING_SERVICES;
package body ADS_DIAL_IO is
function TO_ULW ( X : SYSTEM.ADDRESS ) return SYSTEM.UNSIGNED_LONGWORD
renames SYSTEM.TO_UNSIGNED_LONGWORD;
CLAVIER : STARLET.CHANNEL_TYPE; clavier = keyboard in french
ITEMLIST: STARLET.ITEM_LIST_TYPE(0..1);
function TRANSLATE_STATUS (STATUS : CONDITION_HANDLING.COND_VALUE_TYPE)
return STRING is
ST_GETMSG : CONDITION_HANDLING.COND_VALUE_TYPE;
TEXT_ST : STRING (1..132);
TEXT_RET : STRING (1..80) := ( others => ' ' );
LG_TEXT_ST : SYSTEM.UNSIGNED_WORD;
begin
-- translate status => string
STARLET.GETMSG
( STATUS => ST_GETMSG,
MSGID => STATUS,
MSGLEN => LG_TEXT_ST,
BUFADR => TEXT_ST );
if CONDITION_HANDLING.SUCCESS (ST_GETMSG) then
if INTEGER(LG_TEXT_ST) < TEXT_RET'LENGTH then
TEXT_RET (1..INTEGER(LG_TEXT_ST)) := TEXT_ST(1..INTEGER(LG_TEXT_ST));
else
TEXT_RET := TEXT_ST(1..TEXT_RET'LENGTH);
end if;
else
TEXT_RET (1..32) := "Error in TRANSLATE_STATUS";
end if;
return TEXT_RET;
end TRANSLATE_STATUS ;
function GETKEY return CHARACTER
is
STATUS : CONDITION_HANDLING.COND_VALUE_TYPE;
IOSB : STARLET.IOSB_TYPE;
TXT : STRING ( 1 .. 10 );
FUNC : constant := STARLET.IO_READVBLK + STARLET.IO_M_EXTEND ;
begin
TASKING_SERVICES.TASK_QIOW
( STATUS => STATUS,
CHAN => CLAVIER,
FUNC => FUNC,
IOSB => IOSB,
P1 => TO_ULW( TXT'address ),
P2 => SYSTEM.UNSIGNED_LONGWORD( TXT'length ) ,
P5 => TO_ULW( ITEMLIST'address ),
P6 => SYSTEM.UNSIGNED_LONGWORD( ITEMLIST'size/8 ) );
if not CONDITION_HANDLING.SUCCESS ( STATUS ) then
TEXT_IO.PUT_LINE ("TASK_QIOW: " & TRANSLATE_STATUS( STATUS ) ) ;
end if ;
return TXT( 1 );
end GETKEY;
begin
STARLET.ASSIGN( STAT,
"TT:",
CLAVIER ); -- assign channel for keyboard
-- QIO read initialisation
ITEMLIST(0).BUF_LEN:= 0;
ITEMLIST(0).ITEM_CODE:= STARLET.TRM_ESCTRMOVR;
ITEMLIST(0).BUF_ADDRESS:= SYSTEM.TO_ADDRESS(9);
ITEMLIST(0).RET_ADDRESS:= SYSTEM.ADDRESS_ZERO;
ITEMLIST(1).BUF_LEN:= 0;
ITEMLIST(1).ITEM_CODE:= STARLET.TRM_MODIFIERS;
ITEMLIST(1).BUF_ADDRESS:= SYSTEM.TO_ADDRESS(
STARLET.TRM_M_TM_ESCAPE +
STARLET.TRM_M_TM_NOECHO +
STARLET.TRM_M_TM_CVTLOW +
STARLET.TRM_M_TM_PURGE +
STARLET.TRM_M_TM_NOFILTR );
ITEMLIST(1).RET_ADDRESS:= SYSTEM.ADDRESS_ZERO;
end ADS_DIAL_IO;
--
* Jake Hamby - "Linux: The Choice of a GNU Generation" *
* E-MAIL: jehamby@lightside.com + jehamby@vms4.sci.csupomona.edu *
* http://vms4.sci.csupomona.edu/~jehamby/index.html *
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1995-02-10 12:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-01-27 7:05 Unbuffered keyboard input on VAX ADA? Jake E. Hamby
-- strict thread matches above, loose matches on Subject: below --
1995-02-02 0:40 Jake E. Hamby
[not found] ` <1995Feb3.103003.9017@eisner>
[not found] ` <EMERY.95Feb3123217@goldfinger.mitre.org>
1995-02-10 12:35 ` Larry Kilgallen, LJK Software
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox