Date: Wed, 15 Oct 1997 21:44:40 +0930 From: Mike Smith <mike@smith.net.au> To: stesin@gu.net Cc: Mike Smith <mike@smith.net.au>, hackers@FreeBSD.ORG Subject: Re: Call for Fortran assistance. Message-ID: <199710151214.VAA00326@word.smith.net.au> In-Reply-To: Your message of "Wed, 15 Oct 1997 12:37:25 %2B0300." <Pine.BSF.3.96.971015121206.1265F-100000@trifork.gu.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710151214.VAA00326>