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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,31779cbaecd58cf9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-19 10:29:33 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!paladin.american.edu!auvm!PSAVAX.PWFL.COM!CONDIC Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU Newsgroups: comp.lang.ada Message-ID: <9410191629.AA21032@ajpo.sei.cmu.edu> Date: Wed, 19 Oct 1994 12:26:17 EDT Sender: Ada programming language From: CONDIC@PSAVAX.PWFL.COM Subject: Re: HELP Comments: To: INFO-ADA@ajpo.sei.cmu.edu Date: 1994-10-19T12:26:17-04:00 List-Id: From: Marin David Condic, 407.796.8997, M/S 731-93 Subject: Re: Re: HELP Original_To: PROFS%"SMTP@PWAGPDB" Original_cc: CONDIC >dewar@cs.nyu.edu (Robert Dewar) writes: > >>Time for another reminder. It is useless to ask questions about features >>like this that are implementation dependent unless you tell us what >>compiler you are using, what version, what operating system, what >>machine etc. > >I am using DEC ada and I think it is Ada 83 compiler. > I believe that the original question was how to read a single character input from the keyboard. Given that you're using DEC Ada83, I can tell you how we have dealt with it. One method is to rely on the DEC OS calls in the SMG library. (This involves more than a simple call, since you first have to set up a sort of pseudo-windowing environment that tries to make a VT terminal behave more like Motif!) Anyway, the relavent call can be interfaced with as follows: =============================================================================== = ------------------------------------------------------------------------------- -- Read a Single Character -- -- SMG$READ_KEYSTROKE status, keyboard_id, word_terminator_code -- [,prompt_string] [,timeout] [,display_id], [,rendition_set] -- [,rendition_compliment] -- -- status = Return status of call -- keyboard_id = id of the virtual keyboard you are reading from -- prompt_string = string used for prompt -- timeout = if specified, any character typed before time_out -- is returned in the buffer -- display_id = id of the virtural display -- rendition_set = video attributes for text -- rendition_compliment = video attributes for text -- ------------------------------------------------------------------------------- procedure SMG_READ_KEYSTROKE ( STATUS : out CONDITION_HANDLING.COND_VALUE_TYPE; KEYBOARD_ID : in KEYBOARD_TYPE; WORD_TERMINATOR_CODE : out UNSIGNED_WORD; PROMPT_STRING : in STRING := STRING'NULL_PARAMETER; TIMEOUT : in INTEGER := INTEGER'NULL_PARAMETER; DISPLAY_ID : in DISPLAY_TYPE := DISPLAY_TYPE'NULL_PARAMETER; RENDITION_SET : in SYSTEM.UNSIGNED_LONGWORD := SYSTEM.UNSIGNED_LONGWORD'NULL_PARAMETER; RENDITION_COMPLIMENT : in SYSTEM.UNSIGNED_LONGWORD := SYSTEM.UNSIGNED_LONGWORD'NULL_PARAMETER pragma INTERFACE (VAXRTL, SMG_READ_KEYSTROKE); pragma IMPORT_VALUED_PROCEDURE ( INTERNAL => SMG_READ_KEYSTROKE, EXTERNAL => "SMG$READ_KEYSTROKE", PARAMETER_TYPES => (COND_VALUE_TYPE, UNSIGNED_LONGWORD, UNSIGNED_WORD, STRING, INTEGER, UNSIGNED_LONGWORD, UNSIGNED_LONGWORD, UNSIGNED_LONGWORD), MECHANISM => (VALUE, REFERENCE, REFERENCE, DESCRIPTOR, REFERENCE, REFERENCE, REFERENCE, REFERENCE)); =============================================================================== I believe this call is duplicated in a package DEC provides called "SMG" (appropriately enough!) Do an ACS command as follows ACS> EXTRACT SOURCE/SPEC SMG An alternate technique which only works moderately well, but does provide for asynchronous keyboard/terminal behavior is to connect an asynchronous system trap (AST) to a task entry and tie the AST to the appropriate low level QIO routines. We've done this around here and found that it can't always respond fast enough - but it's still useful. How to do this is sufficiently complex that I'd probably never give you a satisfying answer herin. Check the VAX/VMS manuals on AST's and QIO's to understand how they work, then check the DEC Ada manual to see how to connect an AST to a task entry. Pax Vobiscum, Marin Marin David Condic, Senior Computer Engineer ATT: 407.796.8997 M/S 731-93 Technet: 796.8997 Pratt & Whitney, GESP Internet: CONDICMA@PWFL.COM P.O. Box 109600 Internet: MDCONDIC@AOL.COM West Palm Beach, FL 33410-9600 =============================================================================== Glendower: "I can call spirits from the vasty deep." Hotspur: "Why so can I, or so can any man; but will they come when you do call for them?" -- Shakespeare, "Henry IV" ===============================================================================