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 X-Received: by 10.224.7.66 with SMTP id c2mr27884098qac.7.1413999542385; Wed, 22 Oct 2014 10:39:02 -0700 (PDT) X-Received: by 10.140.84.137 with SMTP id l9mr49006qgd.12.1413999542368; Wed, 22 Oct 2014 10:39:02 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cm18no364556qab.0!news-out.google.com!u5ni12qab.1!nntp.google.com!cm18no364551qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 22 Oct 2014 10:39:02 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.229.110.218; posting-account=wEPvUgoAAABrLeiz_LRhQ3jeEhyfWVMH NNTP-Posting-Host: 71.229.110.218 References: <7c1b89e6-9ab8-4faa-b60c-c5c4683f0bff@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <87dab7c9-95d8-4354-a4c2-53971c2167cb@googlegroups.com> Subject: Re: Assembling Complex Strings Containing Carriage Returns Prior to Using Ada.Text_IO.Put? From: NiGHTS Injection-Date: Wed, 22 Oct 2014 17:39:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3346 X-Received-Body-CRC: 4068377960 Xref: news.eternal-september.org comp.lang.ada:22671 Date: 2014-10-22T10:39:02-07:00 List-Id: On Wednesday, October 22, 2014 2:25:25 AM UTC-4, Jeffrey Carter wrote: > On 10/21/2014 10:57 PM, NiGHTS wrote: >=20 > >=20 >=20 > > Complex_String : Ada.Strings.Unbounded.Unbounded_String; >=20 > > EOL : String :=3D ASCII.CR'Img; >=20 >=20 >=20 > I presume you're using GNAT; this gives you the image of the enumeration = value >=20 > CR; I suspect you want the enumeration value (character) itself. Try usin= g >=20 >=20 >=20 > EOL : constant Character :=3D Ada.Characters.Latin_1.CR; >=20 >=20 >=20 > 'Img is a non-standard, vendor-dependent attribute; you should not use it= in >=20 > production code if you have any interest in portability. ASCII is an obso= lete >=20 > unit and should not be used. >=20 >=20 >=20 > What system uses CR for line terminators these days? I suspect the result= will >=20 > not be what you expect, which is why a better approach would be to actual= ly >=20 > convert this to Ada and simply use a series of Put_Line statements, rathe= r than >=20 > trying to copy the mistakes of C in Ada. >=20 >=20 >=20 > > The searches I performed on Google seem to be void of any hints on how = to get this working. I can't imagine that I am the only one with this requi= rement in Ada. >=20 >=20 >=20 > That's because this is not the Ada Way. >=20 >=20 >=20 > --=20 >=20 > Jeff Carter >=20 > "We call your door-opening request a silly thing." >=20 > Monty Python & the Holy Grail >=20 > 17 Do keep in mind that the strategy of buffering output before sending it to = screen is not "old", its "smart". I did consider what you suggested for thi= s particular project, but then I realized that rewriting the code in questi= on to use Put_Line would actually make the code both less readable and far = less efficient, both things which are not the Ada way. While using Put_Line is safer in its portability, its avoidance in this par= ticular instance is comparable to favoring "goto" for a specific section of= code after determining the alternative as being more complex or otherwise = less desirable. Thank you for your response.