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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c75fd3043cfdcb58 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.180.24.135 with SMTP id u7mr298027wif.3.1343910204576; Thu, 02 Aug 2012 05:23:24 -0700 (PDT) Received: by 10.224.78.205 with SMTP id m13mr391135qak.7.1343910199410; Thu, 02 Aug 2012 05:23:19 -0700 (PDT) Path: n2ni4546127win.0!nntp.google.com!7no4031073wig.0!news-out.google.com!a15ni1807qag.0!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!news.matabio.net!jeffrey.matabio.net!thue.elzevir.fr!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!198.186.194.247.MISMATCH!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Michael Rohan Newsgroups: comp.lang.ada Subject: Re: Formatted IO - Fortran style or similar. Date: Mon, 30 Jul 2012 11:57:12 -0700 (PDT) Organization: http://groups.google.com Message-ID: <37475541-c2ae-48ca-8a52-3ae707ba8860@googlegroups.com> References: <50164ad8$0$1156$5b6aafb4@news.zen.co.uk> NNTP-Posting-Host: 208.91.2.2 Mime-Version: 1.0 X-Trace: posting.google.com 1343674633 10487 127.0.0.1 (30 Jul 2012 18:57:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 30 Jul 2012 18:57:13 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=208.91.2.2; posting-account=1YPeQwoAAACAk-xhKPD32B0GIDdsFFtk User-Agent: G2/1.0 X-Received-Bytes: 4455 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: 2012-07-30T11:57:12-07:00 List-Id: On Monday, July 30, 2012 2:59:07 AM UTC-7, Ian Clifton wrote: > Mark Murray writes: >=20 >=20 >=20 > > Is there anyting in the Ada Standard Library (or the language itself) >=20 > > that acts /in loco/ Fortran's formatted I/O or C's printf()/scanf()? >=20 >=20 >=20 > > I know these can be written as required, and I know that there are ways >=20 > > to call C's printf()/scanf() functions from Ada, but I'm interested to >=20 > > see if there is not already something "in the box". Yes, I'm aware of >=20 > > the formatting capabilities of put()/get(), but that's not quite what >=20 > > I'm wondering about. >=20 >=20 >=20 > I=E2=80=99m not quite sure what facilities you=E2=80=99re after=E2=80=94I= don=E2=80=99t know C=E2=80=99s >=20 > printf()/scanf(), but presumably they are quite different from Fortran=E2= =80=99s >=20 > format control=E2=80=94but I suspect the answer is going to be =E2=80=9CA= da=E2=80=99s approach >=20 > is different=E2=80=9D (see below). >=20 >=20 >=20 > > I could have sworn I saw a PL/1-style "picture" version of this, but I'= m >=20 > > coming round to believing that this was "customer code", not standard >=20 > > library. >=20 >=20 >=20 > Here, you could be thinking about =E2=80=9CEdited Output for Decimal type= s=E2=80=9D, >=20 > described in the ARM Appendix F.=20 >=20 >=20 >=20 > > PS: Is it really the case that put(some_integer,16) will _always_ >=20 > > print the '16#9999#' format, and that there is on way _in_the_ >=20 > > _standard_library_ of *not* getting the '16#.....#' wrapper? >=20 > > Yes, I know there are ways you can get rid of it (eg with a slice), or >=20 > > by "rolling your own" - alternatives aren't my question here :-). >=20 >=20 >=20 > I believe Ada=E2=80=99s approach is to specify the results of >=20 > put(some_integer,16) sufficiently carefully that you can do such >=20 > post=E2=80=90processing with the provided string manipulation packages an= d be >=20 > confident of the final result. In other words, what you are trying to >=20 > avoid ARE the language=E2=80=99s facilities for doing this sort of thing.= I ought >=20 > to mention in passing, the Ada.Text_IO packages are a little >=20 > controversial, many dislike them, but I believe they are under=E2=80=90ra= ted. >=20 >=20 >=20 > --=20 >=20 > Ian =E2=97=8E Hi, While the intent of my library (ZanyBlue) is currently focused on localizat= ion support, I do support ad hoc in lining of messages (they should be external= ized to a properties file), e.g., Print_Line ("Vector norm is {0,real,10.2f} with rank of {1,integer}", +Norm, +Rank); Note, while type info is given in the in line message string, the library d= oes not do type checking for these ad hoc strings. You would need externalized= and use assessors, e.g., Summary=3DVector norm is {0,real,10.2f} with rank of {1,integer} with Print_Summary (+Norm, +Rank); in the code and let the compiler do the type checking. See http://zanyblue.sourceforge.net