From: defaria@hpclapd.HP.COM (Andy DeFaria)
Subject: Re: How do I read in a character w/out pressing return ?
Date: 21 Nov 90 19:25:12 GMT [thread overview]
Message-ID: <920037@hpclapd.HP.COM> (raw)
In-Reply-To: 3858@uniol.UUCP
Seems we just went through this discussion a little while back.
There is no good way to do it using pure Ada. The best way to accomplish
this, IMHO, is to interface with the OS system call that reads a character.
Encapsulate this procedures (GET_KEY) into a package (SYSTEM_CALLS) to
minimize and localize portablity concerns. The Ada call will 1) insure the
types coming in and going out are correct and pragma INTERFACE to the
correct system call (depending, of course, on the OS in question).
so (hypothetical example, assume reasonable type definitions):
package SYSTEM_CALLS is
type STATUS_TYPE is new INTEGER;
type CHAR_PTR is access CHARACTER;
OK : constant STATUS_TYPE := 0;
function GET_KEY (THE_CHARACTER : in CHAR_PTR) return STATUS_TYPE;
pragma INTERFACE (C, GET_KEY);
pragma INTERFACE_NAME (GET_KEY, "getchar");
end SYSTEM_CALLS;
prev parent reply other threads:[~1990-11-21 19:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1990-11-19 12:31 How do I read in a character w/out pressing return ? Arne Gehlhaar
1990-11-21 19:25 ` Andy DeFaria [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox