comp.lang.ada
 help / color / mirror / Atom feed
From: randhol+abuse@pvv.org (Preben Randhol)
Subject: Re: Possible gnat and ObjectAda bugs?
Date: 2000/11/26
Date: 2000-11-26T23:03:45+00:00	[thread overview]
Message-ID: <slrn9235o1.f1.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: 9VPT5.39609$A2.8013565@newsrump.sjc.telocity.net

On Sat, 25 Nov 2000 08:23:05 -0600, David C. Hoos, Sr. wrote:
>The code at the end of this message produces strange results with GNAT
>3.13p,
>and even more bizarre results with ObjectAda 7.1:
>
>What is strange is that when Standard Input is from the keyboard, the
>program
>does not enter the loop until the enter key has been pressed.
>
>Is this a bug, or am I missing something here?

Looks like Ada.Text_IO.Current_Input expects input that are terminated
by a new_line. Though your code would raise an exception if one hit \x04
(EOF) from the keyboard. I think I would have done something like this:


with Ada.Text_IO;
with Ada.IO_Exceptions;
procedure Echo
is
   C : Character;
begin
  loop
    begin
      Ada.Text_IO.Put_Line
        (Ada.Text_IO.Standard_Error,
         "Waiting for character...");
      Ada.Text_IO.Get_Immediate (C);

      Ada.Text_IO.Put_Line
      (Ada.Text_IO.Standard_Error,
       "Got character at position" &
       Integer'Image (Character'Pos (C)));
      Ada.Text_IO.Put (Ada.Text_IO.Current_Output, C);
    exception
      when Ada.Io_Exceptions.End_Error =>
        Ada.Text_IO.Put_Line
          (Ada.Text_IO.Standard_Error,
            "Ending...");
      exit;
    end;
   end loop;
end Echo;

-- 
Preben Randhol ---------------- http://www.pvv.org/~randhol/ --
iMy favorite editor is Emacs!<ESC>bcwVim<ESC>
                                         -- vim best-editor.txt




  reply	other threads:[~2000-11-26  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-25  0:00 Possible gnat and ObjectAda bugs? David C. Hoos, Sr.
2000-11-26  0:00 ` Preben Randhol [this message]
2000-11-27  0:00 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox