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.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) Subject: Re: Text input on a console Date: 1997/04/27 Message-ID: <862121330.22snx@jvdsys.nextjk.stuyts.nl>#1/1 X-Deja-AN: 237755163 Distribution: world References: <01bc524d$a0fe21a0$28f982c1@xhv46.dial.pipex.com> Organization: *JerryWare HQ*, Leiden, Holland Newsgroups: comp.lang.ada Date: 1997-04-27T00:00:00+00:00 List-Id: In article <01bc524d$a0fe21a0$28f982c1@xhv46.dial.pipex.com> Nick.Roberts@dial.pipex.com writes: >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. "Define informally" ? Although I sympathize with the idea, how would one go about this ? >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)? Like Get vs Get_Immediate ? The problem is of course how to go about it in a portable way as this is purely OS dependend. >Should special characters >(like backspace, control-D, control-Z, ESC, etc.) be automatically >supported? As these are part of Latin-1 that shouldn't be much of a problem, but how about Ctrl-Home or Gold-F1 ? Or are you talking about the Line Editing features of the OS ? > 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?) One solution might be the way C compilers for DOS solved it: using a special Console I/O (conio) package. This could be in a special Annex, applicable only to platforms that support terminal based or interactive I/O. Since the IS Annex comes close to this, I wonder if such a package (which would do wonders for the portability of console apps) has been considered. A good candidate would be a binding to termios, if it were supported on all platforms (GNAT doesn't, it even can't agree on the implementation of Get_Immediate between different ports...) >Comments welcome. You asked for it :-) -- -- Jerry van Dijk | Leiden, Holland -- Business Consultant | Team Ada -- Ordina Finance | jdijk@acm.org