Foptions [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
Foptions
The structure tag fop names a structure that describes the bit positions
of the MPE/iX FOPEN intrinsic's foptions. The structure is:
struct fop {
unsigned short reserved:2; /* for MPE/iX */
unsigned short typer:3; /* file type */
unsigned short no_f_equ:1; /* no file equations */
unsigned short label:1; /* labeled tape option */
unsigned short carriage:1; /* carriage control needed */
unsigned short format:2; /* record format */
unsigned short designator:3; /* default designator */
unsigned short ascii:1; /* ASCII(1)/binary(0) */
unsigned short domain:2; /* file domain */
};
In addition to the fop structure, <mpe.h> contains a typedef called
foptions that is the union of an unsigned short and an fop structure.
The typedef is:
typedef union {
struct fop fs;
unsigned short fv;
} foptions;
This typedef is useful for declaring regions of storage that are to serve
as foptions. If a variable f is declared as being type foptions, then
f.fv accesses the unsigned short version of the foptions while f.fs
accesses the structural definition of the foptions. For example:
#include <mpe.h>
#pragma intrinsic FOPEN MPE_FOPEN
main
{
foptions f; /* declare f as an foption variable */
. . .
f.fv = 0; /* clear all options to 0 */
f.fs.ascii = 1; /* set ASCII foption to true */
f.fs.no_f_equ = 1; /* disallow file equations */
MPE_FOPEN(. . , f.fv, . . .); /* pass foptions */
. . .
}
Note, in the above example, the foptions variable can be accessed as
named bit-fields using the f.fs construct or as a 16-bit unsigned short
value using the f.fv construct. Also, notice the FOPEN intrinsic has
been given the name MPE_FOPEN in this example to avoid confusion with the
C library function fopen.
MPE/iX 5.0 Documentation