Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!masscomp!andyo From: andyo@glasperl.masscomp (Andy Oram) Newsgroups: comp.lang.fortran Subject: Re: Fortran compiler test Message-ID: Date: 19 Oct 90 15:53:19 GMT References: <1990Oct18.160412.8187@virtech.uucp> <6662@jhunix.HCF.JHU.EDU> <1990Oct19.012745.7875@virtech.uucp> Sender: news@masscomp.ccur.com Organization: Concurrent Computer Corporation - Westford, Ma Lines: 57 In-reply-to: cpcahil@virtech.uucp's message of 19 Oct 90 01:27:45 GMT I've been communicating with Conor P. Cahill through e-mail, but since people are interested in the test for reading a stream bytes, I'll post this version I just did (it's different from what I sent you, Conor). I'm not tuned in to every variation in FORTRAN's and OS's, but I think that the following are the only system-dependent things that I know the program depends on (besides, of course, the extension you're trying to test): 1. The program assumes that direct-access, unformatted files contain exactly the data that the program writes to them -- no extra record delimiters, etc. On UNIX systems I think this is a fair assumption, since the original f77 compiler was based on it. If it's not true, the whole notion of file as byte stream breaks down anyway. 2. A character is one byte. If anybody thinks THIS assumption is unsafe, let them suggest another standard data type that's more reliable. (My background is that I wrote the latest few versions of MASSCOMP's Fortran manual.) CHARACTER*8 STRING INTEGER IERR OPEN(1,RECL=8,ACCESS='DIRECT',FORM='UNFORMATTED',STATUS='NEW') WRITE(1,REC=1)'SPQRSPQR' CLOSE(1) C OPEN(1,RECL=1,ACCESS='DIRECT',FORM='UNFORMATTED') READ(1,REC=1,IOSTAT=IERR)STRING IF(IERR .NE. 0)THEN WRITE(6,1000)IERR ELSEIF(STRING.EQ.'SPQRSPQR')THEN WRITE(6,1001)STRING ELSE WRITE(6,1002)STRING ENDIF 1000 FORMAT(1X,'ERROR: ',I5) 1001 FORMAT(1X,'OK -- GOT ',A8) 1002 FORMAT(1X,'NOT OK -- GOT ',A8) STOP END ------------------------------------------------------------------------------- Andrew Oram Concurrent Computer Corporation (I don't represent Concurrent; this message represents my own opinion) Digital Communications Route: andyo@westford.ccur.com {harvard,uunet,petsd}!masscomp!andyo Analog Communications Route: (508) 392-2865 Automatic UN*X documentation utility: cref | compress | crypt | man -------------------------------------------------------------------------------