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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1e8499abed674d1c X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Text input on a console Date: 1997/04/26 Message-ID: <01bc524d$a0fe21a0$28f982c1@xhv46.dial.pipex.com>#1/1 X-Deja-AN: 237542551 References: <01bc49c1$c8c990a0$c47d8ea1@AaBbCcDd> <01bc4d85$4c127b40$f4f582c1@xhv46.dial.pipex.com> Organization: UUNet PIPEX server (post doesn't reflect views of UUNet PIPEX) Newsgroups: comp.lang.ada Date: 1997-04-26T00:00:00+00:00 List-Id: Keith Thompson wrote in article ... > In <01bc4d85$4c127b40$f4f582c1@xhv46.dial.pipex.com> "Nick Roberts" writes: > > The answer is to use > > > > Get_Line(Command); > > > > instead of just > > > > get(command) > > > > Reason why: things getting stuck in the buffer. > > That's the problem, but it's not the solution. > > In the previously posted program, Command is an object of an enumeration > type. There is no Get_Line procedure for enumeration types (though it > wouldn't be difficult to write one). I blunder again. Sorry (the little yellow tablets strike again). However, this does raise another point, of more general interest. The behaviour of a program when inputting text from a console is relatively undefined in Ada (as in most languages). It may be impracticable to try to formally define things more closely (i.e. in the RM), but it may be sensible to informally define things a little bit more than the RM, somehow. When GET is used to read a string, or other type, from the console, should the program wait for a carriage-return ('cooked' or 'buffered' mode) or just get the characters directly ('raw' mode)? Should special characters (like backspace, control-D, control-Z, ESC, etc.) be automatically supported? Should there be some agreed parameters in the FORM parameter to specify this sort of thing? (And, in which case, what do we do about STANDARD_INPUT?) Comments welcome. Nick.