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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Text_IO, was: Re: Something I don't understand Date: Thu, 20 Feb 2014 01:09:27 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <4a3e55f6-9f54-4084-9f37-96efd4b0d349@googlegroups.com> <0b358700-871b-4603-addd-65e07c7d59e5@googlegroups.com> Injection-Date: Thu, 20 Feb 2014 01:09:27 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e458ff8b81bc0c159989eb0e36c6e372"; logging-data="6417"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+US0gfW26Cv6RTutCgsXCXpi/mCvoF5UY=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:yH+JyPTqj453ZU5NNa8CZQ40+ps= X-Original-Bytes: 2853 Xref: number.nntp.dca.giganews.com comp.lang.ada:185020 Date: 2014-02-20T01:09:27+00:00 List-Id: On 2014-02-19, Jeffrey Carter wrote: > On 02/19/2014 02:46 PM, Robert A Duff wrote: >> >> Put("There were \1 warnings and \2 errors.\n", >> Image(Warning_Count), Image(Error_Count)); > > And then you end up with > > There were 1 warnings and 1 errors. > > I suppose you could have > > Put ("There were \1 \2 and \3 \4.\n", > Image (Warning_Count), > (if Warning_Count = 1 then "warning" else "warnings"), > Image (Error_Count), > (if Error_Count = 1 then "error" else "errors") ); > > but then the Template is essentially unreadable. > Are you familiar with the VMS $FAO directive (which is the way VMS does template formatting) ? Background material on $FAO is at: http://h71000.www7.hp.com/doc/82final/4527/4527pro_047.html The table of formatting directives are at the bottom of that page. Of interest is the directive "!%S" which inserts either "S" or "s" if the most recent numeric value was not one, the directive "!n%C" which inserts a specific string if the previous numeric field value matches the "n" condition and the "!%E" directive which inserts a string if the previous numeric field value did _not_ match a previous "!n%C" test. Something like that would handle this problem rather cleanly. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world