comp.lang.ada
 help / color / mirror / Atom feed
From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe)
Subject: Re: *Direct* input from keyboard
Date: 1996/04/30
Date: 1996-04-30T00:00:00+00:00	[thread overview]
Message-ID: <4m48gd$hm5@goanna.cs.rmit.edu.au> (raw)
In-Reply-To: 1996Apr29.174806.14478@relay.nswc.navy.mil


skuiper@nswc.navy.mil (S Kuiper (NSWCDD)) writes:
...
>I'm trying to take input
>directly from the keyboard as a control device.
...
>I would like to be able to "sense" when arrow keys or certain
>letters are depressed and take action accordingly.

>I assume I will have to open the keyboard as a device (ie /dev/kbd) and then
>do a "Get".  But does anyone know what the return value of the arrow keys on a 
>keyboard are?  there is no reference to them in the Standard Package.

There is no fixed set of function keys for keyboards.
My Atari ST, Mac, Sun-3/50 and an IBM PC all have different sets.
There isn't anything in the Fortran, Pascal, C, Modula-2 (is that finished
yet?), C++ (is _that_ finished yet?), PL/I, Ada 83, or Ada 95 standards
that requires or assumes the _existence_ of a keyboard.

Since you mention /dev/kbd, I presume you are using a UNIX system.
In that case, your best bet by a long way is simply to

	- use the UNIX "curses" library (comes standard with UNIX)
	- write a small amount of "glue" code in C
	- use Ada.Interfaces.C to call it from your Ada code.

Given an Ada 95 compiler the code should be pretty portable between current
UNIX systems.  The curses library will take care of mapping terminal-specific
codes to
	KEY_DOWN, KEY_UP, KEY_LEFT, KEY_RIGHT,
or lots of others.

It would be rather nice to have an Ada "thick binding" to Curses.  Now that
we have Ada.Interfaces.C, it should be quite portable between Ada 95
compilers.

-- 
Fifty years of programming language research, and we end up with C++ ???
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.




  reply	other threads:[~1996-04-30  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-29  0:00 *Direct* input from keyboard S Kuiper (NSWCDD)
1996-04-30  0:00 ` Richard A. O'Keefe [this message]
1996-05-01  0:00 ` GAFFNEY.BRIAN
replies disabled

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