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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,66144fcff23c0cc6,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.78.36 with SMTP id y4mr51811wiw.1.1357273950695; Thu, 03 Jan 2013 20:32:30 -0800 (PST) X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63 Path: i11ni350932wiw.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!nntpfeed.proxad.net!news.muarf.org!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: Derek Wyss Newsgroups: comp.lang.ada Subject: Trouble with loop in Ada Date: Fri, 4 Jan 2013 04:32:28 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: NNTP-Posting-Host: 6n4LrrPutoH3bJPo4s7j9Q.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2013-01-04T04:32:28+00:00 List-Id: Hello, I'm new to Ada and I'm trying to write a toy unix command shell just to explore the programming language. So far I have a very small program, but I am confused about its behavior. If I comment line number 11, with the Put procedure, the program loops through as I would expect. However, with that line in the program, I have to manually press enter twice before I enter the loop. Similarly, I have to hit enter one more time after the character I enter is displayed in order for the program to loop again. Can anyone offer an explanation as to why I need to press enter? I suspect it has to do with my use of End_Of_File and the way it "looks ahead" but I'm not really sure. I'm running Linux Mint Debian Edition with the 3.2.0-4-686-pae kernel. I'm also using gnat, the Gnu Ada Compiler, version 4.6. When I compile, I type at the command prompt: gnatmake -gnato -fstack-check -gnatE toy_shell.adb 1 with Ada.Text_IO; 2 use Ada.Text_IO; 3 4 procedure toy_shell is 5 6 input_char: Character; 7 8 begin 9 10 while not (End_Of_File) loop 11 Put("Enter a character> "); 12 Get(input_char); 13 Put("you entered: " & input_char); 14 New_line; 15 end loop; 16 17 end toy_shell; I hope that is enough info. Any help would be greatly appreciated Thanks, Derek