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,e61c8636ef35379d X-Google-Attributes: gid103376,public From: John English Subject: Re: Escape Sequences in Strings Date: 2000/11/16 Message-ID: <3A13C41E.FCBDD34C@bton.ac.uk>#1/1 X-Deja-AN: 694294183 Content-Transfer-Encoding: 7bit References: <3A17B0E2@MailAndNews.com> <3A1275A2.F2A843E9@bton.ac.uk> <8uub09$9sr$1@nnrp1.deja.com> <8uump3$s3o$1@news.huji.ac.il> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@bton.ac.uk X-Trace: saturn.bton.ac.uk 974373946 2720 193.62.183.204 (16 Nov 2000 11:25:46 GMT) Organization: University of Brighton Mime-Version: 1.0 NNTP-Posting-Date: 16 Nov 2000 11:25:46 GMT Newsgroups: comp.lang.ada Date: 2000-11-16T11:25:46+00:00 List-Id: Ehud Lamm wrote: > Robert Dewar wrote in message > news:8uub09$9sr$1@nnrp1.deja.com... > > In article <3A1275A2.F2A843E9@bton.ac.uk>, > > John English wrote: > > > > > Escape sequences are easy enough: > > > Ada.Text_IO.Put(ASCII.ESC & "[2J"); -- clear the screen > > > > > > But we would never want to do that in a program, and indeed > > Ada here helps us avoid the nasty habit of embedding odd > > escape sequences in strings in C without any comments, often > > with a result of making the program non-portable. The proper > > coding in Ada would be: > > > > Clear_Screen : constant String := ASCII.ESC & "[2J"; > > -- ANSI escape sequence for clearing screen. Modify to > > -- meet requirements of your system. > > > > Put (Clear_Screen); > > > > It is almost always wrong to have mysterious constants in code! > > > > And while you are at it, put the constant in a seperate packge of env. > specific control codes. > > -- > Ehud Lamm mslamm@mscc.huji.ac.il > http://purl.oclc.org/NET/ehudlamm <== Me! Hey guys, I agree completely, but I wanted to give a *short* answer, not a complete package hierarchy with all the trimmings... and I said it wasn't the way to go anyway... Give us a break! ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.it.bton.ac.uk/staff/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------