C-----------------------------------------------------------------------
C atio.f: Input/output routines for RPFITS under Solaris-2.
C-----------------------------------------------------------------------
C 1) Uses the TOPEN package for tape I/O as standard Fortran reads
C and writes fail on tape. The header and trailer files with
C each ANSI file must be explicitly skipped over. This is done
C in the AT_OPEN_READ and AT_READ routines. AT_SKIP_EOF is
C included for fast skipping to the next file.
C 2) The SUN Fortran compiler does not allow sequential access
C unformatted file IO so it must be implemented as direct access.
C 3) Creation and writing of RPFITS files is normally done by the AT
C correlator which uses a linux system.
C In fact, AT_CREATE, AT_REOPEN_WRITE and AT_WRITE do not write
C standard ANSI files on SunOS systems and are only here for
C Likewise, when opening a file for output, the SHARED keyword,
C necessary for realtime processing by the Parkes multibeam
C system, is ignored by SunOS.
C $Id: atio.f,v 1.15 2007/07/16 01:11:50 cal103 Exp $
C-----------------------------------------------------------------------
integer function AT_CREATE (fname, async, initsz, lun)
C-----------------------------------------------------------------------
logical async, islabelled, reread
integer initsz, irec(10:99), lenrec(10:99), lun, lunsav
integer TOPEN, istat, GETLUN, lfname
common /atio/ lenrec, irec, reread, lunsav, bufsav
C-----------------------------------------------------------------------
if (fname(1:5).eq.'/dev/') then
lfname = index(fname,' ')
if (lfname.eq.0) lfname = len(fname)
istat = GETLUN(.true., lun)
AT_CREATE = TOPEN(lun, fname(:lfname), islabelled)
istat = GETLUN(.false., lun)
open (lun, file=fname, status='new', access='direct',
+ form='unformatted', recl=lenrec(lun), iostat=AT_CREATE)
integer function AT_REOPEN_WRITE (fname, lun)
C-----------------------------------------------------------------------
C REOPEN file - on disk only.
C-----------------------------------------------------------------------
integer irec(10:99), lenrec(10:99), lun, lunsav
common /atio/ lenrec, irec, reread, lunsav, bufsav
C-----------------------------------------------------------------------
open (lun, file=fname, status='old', access='direct',
+ form='unformatted', recl=lenrec(lun),
+ iostat=AT_REOPEN_WRITE)
integer function AT_OPEN_READ (fname, async, lun)
C-----------------------------------------------------------------------
C "READONLY" is non-standard. Had to remove it.
C-----------------------------------------------------------------------