gpp4
1.3.1
|
FORTRAN API for file i/o. More...
#include <string.h>
#include "ccp4_utils.h"
#include "ccp4_errno.h"
#include "ccp4_fortran.h"
#include "ccp4_file_err.h"
Classes | |
struct | _CCP4IObj |
Typedefs | |
typedef struct _CCP4IObj | CCP4IObj |
Enumerations | |
enum | FILE_KLASS { NONE, CCP4_FILE, CCP4_MAP } |
Functions | |
int | _get_channel () |
CCP4IObj * | _iobj_init () |
FORTRAN_SUBR (QOPEN, qopen,(int *iunit, fpstr lognam, fpstr atbuta, int lognam_len, int atbuta_len),(int *iunit, fpstr lognam, fpstr atbuta),(int *iunit, fpstr lognam, int lognam_len, fpstr atbuta, int atbuta_len)) | |
FORTRAN_SUBR (QQOPEN, qqopen,(int *iunit, fpstr lognam, const int *istat, int lognam_len),(int *iunit, fpstr lognam, const int *istat),(int *iunit, fpstr lognam, int lognam_len, const int *istat)) | |
FORTRAN_SUBR (COPEN, copen,(int *iunit, fpstr filename, int *istat, int filename_len),(int *iunit, fpstr filename, int *istat),(int *iunit, fpstr filename, int filename_len, int *istat)) | |
FORTRAN_SUBR (QRARCH, qrarch,(int *iunit, int *ipos, int *ireslt),(int *iunit, int *ipos, int *ireslt),(int *iunit, int *ipos, int *ireslt)) | |
FORTRAN_SUBR (QWARCH, qwarch,(int *iunit, int *ipos),(int *iunit, int *ipos),(int *iunit, int *ipos)) | |
FORTRAN_SUBR (QCLOSE, qclose,(int *iunit),(int *iunit),(int *iunit)) | |
FORTRAN_SUBR (QMODE, qmode,(int *iunit, int *mode, int *size),(int *iunit, int *mode, int *size),(int *iunit, int *mode, int *size)) | |
FORTRAN_SUBR (QREAD, qread,(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result)) | |
FORTRAN_SUBR (QREADI, qreadi,(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result)) | |
FORTRAN_SUBR (QREADI2, qreadi2,(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result)) | |
FORTRAN_SUBR (QREADR, qreadr,(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result)) | |
FORTRAN_SUBR (QREADQ, qreadq,(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result),(int *iunit, uint8 *buffer, int *nitems, int *result)) | |
FORTRAN_SUBR (QREADC, qreadc,(int *iunit, fpstr buffer, int *result, int buffer_len),(int *iunit, fpstr buffer, int *result),(int *iunit, fpstr buffer, int buffer_len, int *result)) | |
FORTRAN_SUBR (QWRITE, qwrite,(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems)) | |
FORTRAN_SUBR (QWRITI, qwriti,(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems)) | |
FORTRAN_SUBR (QWRITR, qwritr,(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems)) | |
FORTRAN_SUBR (QWRITQ, qwritq,(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems),(int *iunit, uint8 *buffer, int *nitems)) | |
FORTRAN_SUBR (QWRITC, qwritc,(int *iunit, fpstr buffer, int buffer_len),(int *iunit, fpstr buffer),(int *iunit, fpstr buffer, int buffer_len)) | |
FORTRAN_SUBR (QSEEK, qseek,(int *iunit, int *irec, int *iel, int *lrecl),(int *iunit, int *irec, int *iel, int *lrecl),(int *iunit, int *irec, int *iel, int *lrecl)) | |
FORTRAN_SUBR (QBACK, qback,(int *iunit, int *lrecl),(int *iunit, int *lrecl),(int *iunit, int *lrecl)) | |
FORTRAN_SUBR (QSKIP, qskip,(int *iunit, int *lrecl),(int *iunit, int *lrecl),(int *iunit, int *lrecl)) | |
FORTRAN_SUBR (QQINQ, qqinq,(int *istrm, fpstr logname, fpstr filename, int *length, int logname_len, int filename_len),(int *istrm, fpstr logname, fpstr filename, int *length),(int *istrm, fpstr logname, int logname_len, fpstr filename, int filename_len, int *length)) | |
FORTRAN_SUBR (QLOCATE, qlocate,(int *iunit, int *locate),(int *iunit, int *locate),(int *iunit, int *locate)) | |
FORTRAN API for file i/o.
FORTRAN_SUBR | ( | COPEN | , |
copen | , | ||
(int *iunit, fpstr filename, int *istat, int filename_len) | , | ||
(int *iunit, fpstr filename, int *istat) | , | ||
(int *iunit, fpstr filename, int filename_len, int *istat) | |||
) |
Opens filename on io stream iunit. istat corresponds to the open mode.
iunit | iochannel number |
filename | fortran character array giving filename |
istat | file mode |
References ccp4_FtoCString().
FORTRAN_SUBR | ( | QBACK | , |
qback | , | ||
(int *iunit, int *lrecl) | , | ||
(int *iunit, int *lrecl) | , | ||
(int *iunit, int *lrecl) | |||
) |
qback: @iunit: @lrecl:
Backspaces one record, of length @lrecl on diskio stream @iunit.
References ccp4_file_seek().
FORTRAN_SUBR | ( | QCLOSE | , |
qclose | , | ||
(int *iunit) | , | ||
(int *iunit) | , | ||
(int *iunit) | |||
) |
qclose: @iunit: io channel
Closes the file open on diskio stream iunit
References ccp4_file_close().
FORTRAN_SUBR | ( | QLOCATE | , |
qlocate | , | ||
(int *iunit, int *locate) | , | ||
(int *iunit, int *locate) | , | ||
(int *iunit, int *locate) | |||
) |
qlocate: @iunit: @locate:
Returns the current position \meta{locate} in the diskio stream @iunit.
References ccp4_file_tell().
FORTRAN_SUBR | ( | QMODE | , |
qmode | , | ||
(int *iunit, int *mode, int *size) | , | ||
(int *iunit, int *mode, int *size) | , | ||
(int *iunit, int *mode, int *size) | |||
) |
qmode: @iunit: io channel @mode: access mode @size: item size
Changes the diskio access mode for stream @iunit to
@mode. The resulting size in bytes of items for transfer is
returned as @size
References ccp4_file_itemsize().
FORTRAN_SUBR | ( | QQINQ | , |
qqinq | , | ||
(int *istrm, fpstr logname, fpstr filename, int *length, int logname_len, int filename_len) | , | ||
(int *istrm, fpstr logname, fpstr filename, int *length) | , | ||
(int *istrm, fpstr logname, int logname_len, fpstr filename, int filename_len, int *length) | |||
) |
qqinq: @istrm: @filnam: @length:
Returns the name @filnam and @length of the file (if any) open on diskio stream @istrm.
FORTRAN_SUBR | ( | QRARCH | , |
qrarch | , | ||
(int *iunit, int *ipos, int *ireslt) | , | ||
(int *iunit, int *ipos, int *ireslt) | , | ||
(int *iunit, int *ipos, int *ireslt) | |||
) |
qrarch: @iunit: iochannel @ipos: position in file @ireslt: return value
For binary files with a well-determined structure in terms of
[[float]]s and [[int]]s we may want to set up the connected stream to
do transparent reading of files written on a machine with a different
architecture. This is currently the case for map files and
MTZ files and this routine is called from mtzlib and maplib.
qrarch reads the machine stamp at word ipos
for the diskio file on stream iunit and sets up the appropriate
bit-twiddling for subsequent qreads on that stream. The
information read from the file is returned in \meta{ireslt} in the
form fileFT+16fileIT. If the stamp is zero
(as it would be for files written with a previous version of the
library) we assume the file is in native format and needs no
conversion in qread; in this case ireslt will be zero and
the caller can issue a warning. Iconvert and Fconvert are
used by qread to determine the type of conversion (if any) to be
applied to integers and reals.
Fudge:fudge Ian Tickle reports old VAX files which have a machine stamp which is byte-flipped from the correct VAX value,although it should always have been zero as far as I can see. To accommodate this, set the logical NATIVEMTZ and the machine stamp won't be read for any
input files for which qrarch is called.
Extra feature: logical/environment variable CONVERT_FROM may be set
to one of BEIEEE, LEIEEE, VAX or CONVEXNATIVE to avoid
reading the machine stamp and assume the file is from the stipulated
archictecture for all input MTZ and map files for which qrarch is called.
N.B.: leaves the stream positioned just after the machine stamp.
References ccp4_file_setstamp().
FORTRAN_SUBR | ( | QREAD | , |
qread | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | |||
) |
qread: @iunit: io channel @buffer: @nitems: number of items
Reads @nitems in the current mode qmode() from diskio
stream @iunit previously opened by qopen() and
returns
References ccp4_file_read().
FORTRAN_SUBR | ( | QREADC | , |
qreadc | , | ||
(int *iunit, fpstr buffer, int *result, int buffer_len) | , | ||
(int *iunit, fpstr buffer, int *result) | , | ||
(int *iunit, fpstr buffer, int buffer_len, int *result) | |||
) |
qreadc:: @iunit: @buffer:
Fills CHARACTER buffer in byte mode from diskio stream
@iunit previously opened by qopen() and returns
FORTRAN_SUBR | ( | QREADI | , |
qreadi | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | |||
) |
qreadi: @iunit: io channel @buffer:
Fills INT buffer in int mode from diskio stream
@iunit previously opened by qopen() and returns
References ccp4_file_readint().
FORTRAN_SUBR | ( | QREADI2 | , |
qreadi2 | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | |||
) |
qreadi2: @iunit: io channel @buffer:
Fills INT*2 buffer in int mode from diskio stream
@iunit previously opened by qopen() and returns
References ccp4_file_readshort().
FORTRAN_SUBR | ( | QREADQ | , |
qreadq | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | |||
) |
qreadq: @iunit: @buffer: i
Fills COMPLEX buffer in int mode from diskio stream
@iunit previously opened by qopen() and returns
References ccp4_file_readcomp().
FORTRAN_SUBR | ( | QREADR | , |
qreadr | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | , | ||
(int *iunit, uint8 *buffer, int *nitems, int *result) | |||
) |
qreadr: @iunit: @buffer:
Fills REAL] buffer in int mode from diskio stream
@iunit previously opened by qopen() and returns
References ccp4_file_readfloat().
FORTRAN_SUBR | ( | QSEEK | , |
qseek | , | ||
(int *iunit, int *irec, int *iel, int *lrecl) | , | ||
(int *iunit, int *irec, int *iel, int *lrecl) | , | ||
(int *iunit, int *irec, int *iel, int *lrecl) | |||
) |
qseek: @iunit: @irec: @iel: @lrecl:
Seeks to element @iel in record @irec in diskio stream @iunit whose record length is @lrecl.
References ccp4_file_seek().
FORTRAN_SUBR | ( | QSKIP | , |
qskip | , | ||
(int *iunit, int *lrecl) | , | ||
(int *iunit, int *lrecl) | , | ||
(int *iunit, int *lrecl) | |||
) |
qskip: @iunit: @lrecl:
Skip forward 1 record of length @lrecl on diskio stream @iunit.
References ccp4_file_seek().
FORTRAN_SUBR | ( | QWARCH | , |
qwarch | , | ||
(int *iunit, int *ipos) | , | ||
(int *iunit, int *ipos) | , | ||
(int *iunit, int *ipos) | |||
) |
qwarch @iunit: io channel @ipos: position
This is the complement of qrarch, writing the native machine
architecture information machine stamp to diskio stream
iunit at word ipos. Currently called from mtzlib and maplib.
The machine stamp in mtstring is four nibbles in order, indicating complex and real format (must both be the same), integer format and character format (currently irrelevant). The last two bytes of
mtstring are currently unused and always zero.
N.B.: leaves the stream positioned just after the machine stamp.
References ccp4_file_setstamp().
FORTRAN_SUBR | ( | QWRITE | , |
qwrite | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | |||
) |
qwrite: @iunit: @buffer: @meta:
This write @nitems items from @buffer to qopen() stream \meta{iunit} using the current mode.
References ccp4_file_write().
FORTRAN_SUBR | ( | QWRITI | , |
qwriti | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | |||
) |
qwriti: @iunit: @buffer: @nitems:
This write @nitems items from @buffer to qopen() stream @iunit using the INT32 mode.
References ccp4_file_writeint().
FORTRAN_SUBR | ( | QWRITQ | , |
qwritq | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | |||
) |
qwrite: @iunit: @buffer: @nitems:
This write @nitems items from @buffer to qopen() stream @iunit using the COMP64 mode.
References ccp4_file_writecomp().
FORTRAN_SUBR | ( | QWRITR | , |
qwritr | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | , | ||
(int *iunit, uint8 *buffer, int *nitems) | |||
) |
qwritr: @iunit: @buffer: @nitems:
This write @nitems items from @buffer to qopen()
stream @iunit using the FLOAT32 mode.
References ccp4_file_writefloat().