From owner-freebsd-hackers Wed Oct 15 05:19:36 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id FAA05997 for hackers-outgoing; Wed, 15 Oct 1997 05:19:36 -0700 (PDT) (envelope-from owner-freebsd-hackers) Received: from word.smith.net.au (ppp20.portal.net.au [202.12.71.120]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id FAA05951 for ; Wed, 15 Oct 1997 05:19:20 -0700 (PDT) (envelope-from mike@word.smith.net.au) Received: from word.smith.net.au (localhost [127.0.0.1]) by word.smith.net.au (8.8.7/8.8.5) with ESMTP id VAA00326; Wed, 15 Oct 1997 21:44:42 +0930 (CST) Message-Id: <199710151214.VAA00326@word.smith.net.au> X-Mailer: exmh version 2.0zeta 7/24/97 To: stesin@gu.net cc: Mike Smith , hackers@FreeBSD.ORG Subject: Re: Call for Fortran assistance. In-reply-to: Your message of "Wed, 15 Oct 1997 12:37:25 +0300." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 15 Oct 1997 21:44:40 +0930 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > On Wed, 15 Oct 1997, Mike Smith wrote: > > > Our second design threw the data through a FIFO, but Fortran has funny > > formatting requirements for sequential-access data that have stymied us. > > What was so strange there with the formatting? To quote from /usr/src/lib/libI77/README: Unformatted sequential records consist of a length of record contents, the record contents themselves, and the length of record contents again (for backspace). Prior to 17 Oct. 1991, the length was of type int; now it is of type long, but you can change it back to int by inserting > > We tried converting to ASCII and then parsing it back in, but that's > > too slow. > > As far as I recall, Fortran is able to handle "binary" > input records (in a way like one do read(2)/write(2) > of a memory buffer containig a C struct foo { ... }; > or some kind of an array) You can do this with an unformatted file open for direct access, but this fails (blocks forever) on a FIFO. Worse, you can't vary the size of the entity read. 8( > Anyway you will be > able to fill a Fortran array with bytes from an input > stream without any conversion and use the buffer' content > in any way you like then, using Fortran' equivalent > of C union xxx { ... }; that is a COMMON construct. This would be OK if it worked (forgive any syntax, I'm not a Fortran programmer): character*1 foo open(unit=16,file='/tmp/fifo',form='unformatted',access='direct', $ recl=1,status='old') do irec = 0, 10000 read(unit=16,rec=irec,end=200)foo ... enddo but given a FIFO; eg. in a test case: # mkfifo /tmp/fifo # cat /kernel > /tmp/fifo & # ./testprogram it just sits there doing nothing. mike