comp.lang.ada
 help / color / mirror / Atom feed
* How do you read keystrokes in Ada?
@ 1989-05-03 22:30 Kurt T. Meyer
  1989-05-11 11:59 ` Rick Conn
  1989-05-13  2:02 ` John Wolf
  0 siblings, 2 replies; 7+ messages in thread
From: Kurt T. Meyer @ 1989-05-03 22:30 UTC (permalink / raw)



Hi, I need to figure out how to read a single keystroke in
Ada.  As far as I can tell, all available I/O routines wait
for a carriage return before returning input read from the
keyboard.  Does anyone out there know of some code that does
this?  I'm working with Ada on Vax/VMS.

Thanks in advance!

--Kurt (meyer@june.cs.washington.edu)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How do you read keystrokes in Ada?
  1989-05-03 22:30 How do you read keystrokes in Ada? Kurt T. Meyer
@ 1989-05-11 11:59 ` Rick Conn
  1989-05-13  2:02 ` John Wolf
  1 sibling, 0 replies; 7+ messages in thread
From: Rick Conn @ 1989-05-11 11:59 UTC (permalink / raw)


The recently-announced ADA-TUTR in the Ada Software Repository
contains routines for single-character I/O using Verdix Ada on a SUN
(via a C interface), DEC Ada on a VAX (via the VAX/VMS I/O library), and
a second UNIX-C interface (I don't know the origin).  These routines are
isolated in a system dependency package.  See the file in PD1:<MSDOS.ADA> and
PD2:<ADA.EDUCATION> (comment file containing Verdix Ada/SUN).

	Rick
-------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How do you read keystrokes in Ada?
  1989-05-03 22:30 How do you read keystrokes in Ada? Kurt T. Meyer
  1989-05-11 11:59 ` Rick Conn
@ 1989-05-13  2:02 ` John Wolf
  1989-05-18 15:48   ` How do you read keystrokes in A stt
  1 sibling, 1 reply; 7+ messages in thread
From: John Wolf @ 1989-05-13  2:02 UTC (permalink / raw)



If REPRESENTATIVE CLAUSES for interrupt vector addresses are supported
by your compiler then you could write your own charactor I/O interrupt
handler via Ada Tasking.  See REPRESENTATIVE CLAUSE in the green book.
This would be a way to keep all your code Ada, i.e. not linking to
any foreign language objects (this would make the DoD happy).  But I have
yet to find an Ada compiler where REPRESENTATIVE CLAUSES for interrupt 
vectors are supported.  Think of the Real-Time possibilities with High-Level 
language programming if it were implemented.

jwolf@hpda.HP.COM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How do you read keystrokes in A
  1989-05-13  2:02 ` John Wolf
@ 1989-05-18 15:48   ` stt
  1989-05-21 20:36     ` William Thomas Wolfe,2847,
  0 siblings, 1 reply; 7+ messages in thread
From: stt @ 1989-05-18 15:48 UTC (permalink / raw)



They are called "representation clauses."
In particular, the one
to which you refer is an "address clause for an interrupt entry."

There are in fact a number of compilers which support interrupt entries.
However, the more critical issue is whether the operating
system provides an interface which gives non-kernel
code the chance to be informed when a key is typed.
Unix systems generally provide "signals" for
the Interrupt and Quit keys (often "^C" and "^\").
Getting a signal on any key is tougher.

For the purposes of the original question, "raw" or "cbreak"
mode would be adequate on Unix, but again, it depends
on whether the Ada run-time-system supports
these modes, or whether the user wants to "roll their own"
input routines (presumably using pragma Interface).

Similar capabilities exist in VMS, but
the same caveats apply (need support in RTS or roll-your-own).

Tucker Taft
Intermetrics, Inc.
Cambridge, MA

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How do you read keystrokes in A
  1989-05-18 15:48   ` How do you read keystrokes in A stt
@ 1989-05-21 20:36     ` William Thomas Wolfe,2847,
  1989-05-21 23:11       ` Dik T. Winter
  0 siblings, 1 reply; 7+ messages in thread
From: William Thomas Wolfe,2847, @ 1989-05-21 20:36 UTC (permalink / raw)


From article <124000045@inmet>, by stt@inmet:
> Unix systems generally provide "signals" for
> the Interrupt and Quit keys (often "^C" and "^\").
> Getting a signal on any key is tougher.
> For the purposes of the original question, "raw" or "cbreak"
> mode would be adequate on Unix, but again, it depends
> on whether the Ada run-time-system supports
> these modes, or whether the user wants to "roll their own"
> input routines (presumably using pragma Interface).

     This is an area in which a "secondary standard" 
     (maybe even a new predefined package!) is badly needed.

     There should be some means whereby the application writer
     can, in a straightforward and machine-independent way,
     either call some function which will return an object whose
     state will indicate which key was pressed (note: this is NOT
     the same as returning ESC and then returning some other 
     character(s) on succeeding calls, the entire sequence of which
     represents an arrow key or something of that nature...), or
     establish a task entry which will be called when the next keystroke
     occurs, with a similarly "high-level" interface.  This will probably
     require a larger carrier space than CHARACTER provides (unless 9X
     upgrades CHARACTER to ISO Latin 1 (aka 8-bit ASCII)), but it's 
     something which definitely needs to be built up to an appropriate 
     level of abstraction.


     Bill Wolfe, wtwolfe@hubcap.clemson.edu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How do you read keystrokes in A
  1989-05-21 20:36     ` William Thomas Wolfe,2847,
@ 1989-05-21 23:11       ` Dik T. Winter
  1989-05-22 15:43         ` William Thomas Wolfe,2847,
  0 siblings, 1 reply; 7+ messages in thread
From: Dik T. Winter @ 1989-05-21 23:11 UTC (permalink / raw)


Talking about machine independent:

In article <5549@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu writes:
 >      This is an area in which a "secondary standard" 
 >      (maybe even a new predefined package!) is badly needed.
 > 
 >      There should be some means whereby the application writer
 >      can, in a straightforward and machine-independent way,
 >      either call some function which will return an object whose
 >      state will indicate which key was pressed

But how then does the application writer know which key means what?
(Oh yes, I see it: on this keyboard key 17 is 'A', on that keyboard
key 17 is uparrow.)  Moreover, on many systems this is impossible.
-- 
dik t. winter, cwi, amsterdam, nederland
INTERNET   : dik@cwi.nl
BITNET/EARN: dik@mcvax

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How do you read keystrokes in A
  1989-05-21 23:11       ` Dik T. Winter
@ 1989-05-22 15:43         ` William Thomas Wolfe,2847,
  0 siblings, 0 replies; 7+ messages in thread
From: William Thomas Wolfe,2847, @ 1989-05-22 15:43 UTC (permalink / raw)


From article <8131@boring.cwi.nl>, by dik@cwi.nl (Dik T. Winter):
>> There should be some means whereby the application writer
>> can, in a straightforward and machine-independent way,
>> either call some function which will return an object whose
>> state will indicate which key was pressed
% 
% But how then does the application writer know which key means what?
% (Oh yes, I see it: on this keyboard key 17 is 'A', on that keyboard
% key 17 is uparrow.)  Moreover, on many systems this is impossible.

    The keys are generally labeled; e.g., the 'A' key will be labeled A.

    The function then returns some object whose value indicates an 'A'...


    Bill Wolfe, wtwolfe@hubcap.clemson.edu

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1989-05-22 15:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1989-05-03 22:30 How do you read keystrokes in Ada? Kurt T. Meyer
1989-05-11 11:59 ` Rick Conn
1989-05-13  2:02 ` John Wolf
1989-05-18 15:48   ` How do you read keystrokes in A stt
1989-05-21 20:36     ` William Thomas Wolfe,2847,
1989-05-21 23:11       ` Dik T. Winter
1989-05-22 15:43         ` William Thomas Wolfe,2847,

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox