From: Joel VanLaven <jvl@ocsystems.com>
Subject: Re: Buffering inputted characters
Date: 1998/06/20
Date: 1998-06-20T00:00:00+00:00 [thread overview]
Message-ID: <358bf5a3.0@news4.his.com> (raw)
In-Reply-To: 898358420.19245.0.nnrp-08.c2de5e53@news.demon.co.uk
PantsMaster <dougie@drumkit.demon.co.uk> wrote:
: I am attempting to write a game in Ada 95. I am aware that this is hardly
: the most optimal platform for building a game, but nevertheless I am giving
: it a go. What I would like to know is how I can get a program to look for
: (keyboard) input. It would check to see if there has been any, and carry
: out appropriate actions depending on the input. How can this be done
: *without holding up the rest of the program?*
Text_io.get_immediate is your answer. Note that this will also return
control characters like new-lines and such (as opposed to get).
Note that simce this is a new Ada95 feature that requires new ways of
doing things some implementations might not get it completely right :)
However, I think that new features like this have firmed up alot since
the first Ada95 compilers.
Here is A.10.7 (11-12) from the Ada95 LRM:
procedure Get_Immediate(File : in File_Type;
Item : out Character;
Available : out Boolean);
procedure Get_Immediate(Item : out Character;
Available : out Boolean);
f a character, either control or graphic, is available from the specified
File or the default input file, then the character is read; Available is
True and Item contains the value of this character. If a character is not
available, then Available is False and the value of Item is not
specified. Mode_Error is propagated if the mode of the file is not
In_File. End_Error is propagated if at the end of the file. The current
column, line and page numbers for the file are not affected.
Note that there is a get_immediate without the available parameter. This
will cause the program to await input in the same way the get procedure
will.
-- Joel VanLaven
prev parent reply other threads:[~1998-06-20 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <898358420.19245.0.nnrp-08.c2de5e53@news.demon.co.uk>
1998-06-20 0:00 ` Buffering inputted characters Markus Kuhn
[not found] ` <898426975.29878.0.nnrp-06.c2de5e53@news.demon.co.uk>
1998-06-21 0:00 ` Thanks - now another query Markus Kuhn
1998-06-20 0:00 ` Ada for Game programming Markus Kuhn
1998-06-20 0:00 ` Tom Moran
1998-06-21 0:00 ` Jerry van Dijk
1998-06-20 0:00 ` Joel VanLaven [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