next up previous contents FITSIO Home
Next: Testing the FITSIO Library Up: Building the Fortran Library Previous: Using the f2c Compiler

The IRAF SPP Compatible Version of FITSIO

An IRAF compatible version of FITSIO was developed in collaboration with Doug Tody at NOAO. This version of FITSIO uses the IRAF VOS (Virtual Operating System) file I/O calls to access the FITS files rather than using Fortran I/O,

The following source files are needed to build the IRAF compatible version of FITSIO:

fitsio.f     - The Fortran source code for the main body of FITSIO subroutines
fitsio.h     - The SPP include file, used by fitspp.x and fitssppb.x
fitsspp.com  - The SPP common block used by fitsspp.x
fitsspp.x    - The low-level FITSIO subroutines, written in SPP
fitssppvms.x - Version of fitsspp.x for use on VAX and Alpha VMS machines
fitssppb.x   - The top-level SPP interface to FITSIO
mkpkg        - a sample make file which builds the FITSIO library
The SPP version of FITSIO consists of 3 layers of code. At the bottom there is the fitsspp.x SPP source code which contains the IRAF-specific subroutines to read and write data to the FITS file. The middle layer of subroutines are contained in the fitsio.f file which is the same file used in every version of FITSIO. This layer is completely portable and contains no machine or environment dependencies. Finally, a thin interface layer of SPP subroutines are provided in the fitssppb.x file. This top layer of routines is provided for the convenience of SPP programmers and simply performs the conversion between SPP character variables and Fortran character strings.

A sample mkpkg file is provided which will build the FITSIO library in IRAF. There are 2 versions of the fitsspp.x file; the fitssppvms.x file is used on VAX and Alpha VMS machines, while the fitsspp.x file is used on all other platforms. Note that the `fitsio.f' file must be renamed to `fitsio.for' for the mkpkg to function properly.

Once the FITSIO library has been built, IRAF programmers may then call either the SPP or the Fortran subroutine interface to FITSIO; both interfaces end up calling the same low-level SPP VOS interface routines to actually read or write the FITS files. IRAF programs written in Fortran (using either the IRAF IMFORT or the STScI F77 interface to access the IRAF VOS) can simply call the Fortran subroutine interface to FITSIO as specified in later sections of this document.

Programs written in SPP, on the other hand, may call the SPP specific layer of FITSIO subroutines. These routines are identical to the Fortran subroutines except that the SPP subroutines have names beginning with 'fs' rather than 'ft' (e.g., 'call fsopen' rather than 'call ftopen'). The main purpose of this thin layer of SPP routines is to convert any SPP character variables into Fortran character strings before calling the corresponding FITSIO Fortran subroutine. Similarly, any character strings that are returned by the Fortran FITSIO subroutine are converted into SPP CHAR variables before being passed back to the calling SPP routine.

SPP programmers, therefore, should follow the definition of all the FITSIO interface subroutines given in this document, except that the SPP routines have names beginning with 'fs' rather than 'ft', and SPP CHAR variables should be substituted for any Fortran character string variables in the subroutine calling arguments. SPP programmers also need to be aware of the character string length definitions that are used throughout the SPP FITSIO interface as defined in the fitsio.h include file. The SPP version of FITSIO behaves identically to the Fortran version and has exactly the same calling sequences, except for the following special exceptions:

*
FSPKNx: This family of subroutines only supports a single comment string, not an array of comment strings as in the Fortran routines.

*
FSPCLS, FSGCVS, and FSGCFS: These 3 routines all have an additional argument not present in the corresponding Fortran routines. This integer argument, DIM1, follows the character array argument and specifies the size of the 1st dimension of the 2-dimensional CHAR array, e.g.,

    call fspcls(ounit, frow, felem, nelem, nulval, array, DIM1, anynul, status)


next up previous contents FITSIO Home
Next: Testing the FITSIO Library Up: Building the Fortran Library Previous: Using the f2c Compiler