Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"I'm a mean green mother from outer space" -- Audrey II, The Little Shop of Horrors


devel / comp.lang.fortran / Re: User-defined list-directed input

SubjectAuthor
* User-defined list-directed inputThomas Koenig
`- Re: User-defined list-directed inputFortranFan

1
User-defined list-directed input

<t41n7n$pdh$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2164&group=comp.lang.fortran#2164

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: User-defined list-directed input
Date: Sat, 23 Apr 2022 20:23:19 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t41n7n$pdh$1@newsreader4.netcologne.de>
Injection-Date: Sat, 23 Apr 2022 20:23:19 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:f179:0:7285:c2ff:fe6c:992d";
logging-data="26033"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 23 Apr 2022 20:23 UTC

I'm not quite sure how user-defined I/O and list-directed input
go together.

For example, can I just write

module x
implicit none
type foo
real :: r
end type foo
interface read(formatted)
module procedure read_formatted
end interface read(formatted)
contains
subroutine read_formatted (dtv, unit, iotype, vlist, iostat, iomsg)
class (foo), intent(inout) :: dtv
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
read (unit,*,iostat=iostat,iomsg=iomsg) dtv%r
end subroutine read_formatted
end module x

program main
use x
implicit none
type(foo) :: a, b
read (*,*) a, b
print *,a,b
end program main

feed "2*1" to this program, and expect it to work and print
some semblance of " 1.000000 1.000000"? There seems to be nothing
prohibiting this in the standard.

Or assume that I want to read a string of arbitrary length (to read
in the numbers in the example above) using list-directed I/O, for
later conversion with internal I/O, reallocating as I go along in
case the user types 1.000000000000000000000000000000000000000e000.
I cannot use the usual method of using ADVANCE="NO", because that
is ignored in a child I/O statement.

I also did not find a good explanation of these finer points
anywhere.

Re: User-defined list-directed input

<fbd1c5aa-9167-410f-94fc-63df9fedc04fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2167&group=comp.lang.fortran#2167

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:4e46:0:b0:2e1:b933:ec06 with SMTP id e6-20020ac84e46000000b002e1b933ec06mr7681730qtw.684.1650751868064;
Sat, 23 Apr 2022 15:11:08 -0700 (PDT)
X-Received: by 2002:a0d:e296:0:b0:2f7:c169:126f with SMTP id
l144-20020a0de296000000b002f7c169126fmr5851315ywe.431.1650751867858; Sat, 23
Apr 2022 15:11:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 23 Apr 2022 15:11:07 -0700 (PDT)
In-Reply-To: <t41n7n$pdh$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=165.225.39.113; posting-account=ZZXq9AoAAAAQEcA7zKAGm0UFQh4gMBv7
NNTP-Posting-Host: 165.225.39.113
References: <t41n7n$pdh$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fbd1c5aa-9167-410f-94fc-63df9fedc04fn@googlegroups.com>
Subject: Re: User-defined list-directed input
From: parekhvs@gmail.com (FortranFan)
Injection-Date: Sat, 23 Apr 2022 22:11:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 32
 by: FortranFan - Sat, 23 Apr 2022 22:11 UTC

On Saturday, April 23, 2022 at 4:23:22 PM UTC-4, Thomas Koenig wrote:

> ..
> feed "2*1" to this program, and expect it to work and print
> some semblance of " 1.000000 1.000000"? There seems to be nothing
> prohibiting this in the standard.

Nor supporting it in the standard. You may want to inquire at the J3 mailing list about the r*c form of list-directed input and defined IO is supposed to work with it.

You will know feeding "1,1" to that program will work and print your expected output.

>
> Or assume that I want to read a string of arbitrary length (to read
> in the numbers in the example above) using list-directed I/O, for
> later conversion with internal I/O, reallocating as I go along in
> case the user types 1.000000000000000000000000000000000000000e000.
> I cannot use the usual method of using ADVANCE="NO", because that
> is ignored in a child I/O statement.

Not sure what the question is here but child data transfer is effectively nonadvancing and the child data transfer can take advantage of it in asuitable fashion to read in the characters in some sequence, perhaps even one by one, until the delimiter(s) for list-directed input signal the end of transfer and then do the needed conversion.

>
> I also did not find a good explanation of these finer points
> anywhere.

Again ask for any clarification at the J3 mailing list.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor