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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!bu.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!ucsd!nosc!cod!sampson From: sampson@cod.NOSC.MIL (Charles H. Sampson) Newsgroups: comp.lang.ada Subject: Re: Keyboard input Message-ID: <2268@cod.NOSC.MIL> Date: 20 Sep 90 23:20:52 GMT References: <39@screamer.csee.usf.edu> <1990Sep19.192717.13113@planck.uucp> Reply-To: sampson@cod.nosc.mil.UUCP (Charles H. Sampson) Distribution: comp.lang.ada Organization: Computer Sciences Corporation List-Id: In article <1990Sep19.192717.13113@planck.uucp> westley%hercules@planck.UUCP (Terry J. Westley) writes: >In article <39@screamer.csee.usf.edu> stelmack@screamer.csee.usf.edu (Gregory M. Stelmack) writes: >>Is there any way in Ada to read single keystrokes from the keyboard? Not the >>GET from TEXT_IO which requires a carriage return before sending the data, but >>as soon as a key is pressed have it sent? We have a whole Ada class that would >>like to know, and no one here can help figure it out. So, I ask the net. >>We've checked books and can't figure it out. >This is typically a function of the terminal driver, not Ada. In Unix >(SunOS), you have to call ioctl to put the terminal in "raw" mode and >call fcntl to request that the SIGIO signal be delivered to your process. >If SIGIO is being used for anything else (such as socket communication), >you've got a conflict that must be resolved. I've also done it for VxWorks. Lots of operating systems give the programmer the ability to read individual keystrokes, in addition to reading entire lines. I've always assumed that the "usual" Ada approach to inputting single characters (above) was an implementation decision: If the individual keystrokes are read, the system's line-editing features (backspace, start over, etc.) are either lost or must be duplicated in the Ada program. If they're lost, the program becomes very user-unfriendly. For example, if the user enters "A-backspace-B", more than likely only the "B" appears on the screen, but the Ada program has seen all three characters and might even emit an error message about them, which looks like it's complaining about the "B". Implementors, is my assumption about your decision right? Charlie Sampson