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: "Ehud Lamm" Subject: Re: Escape Sequences in Strings Date: 2000/11/15 Message-ID: <8uump3$s3o$1@news.huji.ac.il>#1/1 X-Deja-AN: 694013162 References: <3A17B0E2@MailAndNews.com> <3A1275A2.F2A843E9@bton.ac.uk> <8uub09$9sr$1@nnrp1.deja.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@news.huji.ac.il X-Trace: news.huji.ac.il 974315108 28792 132.64.12.118 (15 Nov 2000 19:05:08 GMT) Organization: The Hebrew University of Jerusalem X-MSMail-Priority: Normal NNTP-Posting-Date: Wed, 15 Nov 2000 19:05:08 +0000 (UTC) Newsgroups: comp.lang.ada Date: 2000-11-15T00:00:00+00:00 List-Id: 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!