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.224.219.205 with SMTP id hv13mr4321793qab.5.1343910210311; Thu, 02 Aug 2012 05:23:30 -0700 (PDT) Path: a15ni8268654qag.0!nntp.google.com!border1.nntp.dca.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!goblin3!goblin.stu.neva.ru!news.matabio.net!jeffrey.matabio.net!thue.elzevir.fr!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!zen.net.uk!hamilton.zen.co.uk!163.1.2.201.MISMATCH!feeds.news.ox.ac.uk!news.ox.ac.uk!not-for-mail From: Ian Clifton Newsgroups: comp.lang.ada Subject: Re: Formatted IO - Fortran style or similar. Date: Mon, 30 Jul 2012 10:59:07 +0100 Organization: Oxford University Message-ID: References: <50164ad8$0$1156$5b6aafb4@news.zen.co.uk> NNTP-Posting-Host: chem-arachne.chem.ox.ac.uk Mime-Version: 1.0 X-Trace: news.ox.ac.uk 1343642346 4535 129.67.70.197 (30 Jul 2012 09:59:06 GMT) X-Complaints-To: newsmaster@ox.ac.uk NNTP-Posting-Date: Mon, 30 Jul 2012 09:59:06 +0000 (UTC) X-Face: UBC;x(*[G|MjJprNEe46g'_ohKo&_1j)xyO.Vp{Aqs]utmX:;onqsta@HWuZ/XLcnUl8:Tw ftqJ]_NiENI}83q%~[/2C!f[!&@p*N9'-weU1%|76wuw7,u$vB:Q2/rT:Xt7/vlATc]_'O$o +$BJ~I+H|df*r>lC?,P?s4W"HC]fP0FT+Ay5.0R{rc0)JICp(z:[gx9k'/JC|hnzbW@#"[t;'I0` User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-GB Date: 2012-07-30T10:59:07+01:00 List-Id: Mark Murray writes: > Is there anyting in the Ada Standard Library (or the language itself) > that acts /in loco/ Fortran's formatted I/O or C's printf()/scanf()? > I know these can be written as required, and I know that there are ways > to call C's printf()/scanf() functions from Ada, but I'm interested to > see if there is not already something "in the box". Yes, I'm aware of > the formatting capabilities of put()/get(), but that's not quite what > I'm wondering about. I’m not quite sure what facilities you’re after—I don’t know C’s printf()/scanf(), but presumably they are quite different from Fortran’s format control—but I suspect the answer is going to be “Ada’s approach is different” (see below). > I could have sworn I saw a PL/1-style "picture" version of this, but I'm > coming round to believing that this was "customer code", not standard > library. Here, you could be thinking about “Edited Output for Decimal types”, described in the ARM Appendix F. > PS: Is it really the case that put(some_integer,16) will _always_ > print the '16#9999#' format, and that there is on way _in_the_ > _standard_library_ of *not* getting the '16#.....#' wrapper? > Yes, I know there are ways you can get rid of it (eg with a slice), or > by "rolling your own" - alternatives aren't my question here :-). I believe Ada’s approach is to specify the results of put(some_integer,16) sufficiently carefully that you can do such post‐processing with the provided string manipulation packages and be confident of the final result. In other words, what you are trying to avoid ARE the language’s facilities for doing this sort of thing. I ought to mention in passing, the Ada.Text_IO packages are a little controversial, many dislike them, but I believe they are under‐rated. -- Ian ◎