From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b86e9e055dc72fc8 X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: *Direct* input from keyboard Date: 1996/04/30 Message-ID: <4m48gd$hm5@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 152177386 references: <1996Apr29.174806.14478@relay.nswc.navy.mil> organization: Comp Sci, RMIT, Melbourne, Australia nntp-posting-user: ok newsgroups: comp.lang.ada Date: 1996-04-30T00:00:00+00:00 List-Id: 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.