/* <vms/lib/fatdef.h>
 *
 *	F11DEF - file attributes definitions	[not in Starlet]
 */
#ifndef _FATDEF_H
#define _FATDEF_H

/*
   Record attributes area as used by FCS and RMS.
 */
/* record format */
#define FAT$C_UNDEFINED 0	/* undefined record type */
#define FAT$C_FIXED	1	/* fixed record type */
#define FAT$C_VARIABLE	2	/* variable length */
#define FAT$C_VFC	3	/* variable + fixed control */
#define FAT$C_STREAM	4	/* RMS-11 (DEC traditional) stream format */
#define FAT$C_STREAMLF	5	/* LF-terminated stream format */
#define FAT$C_STREAMCR	6	/* CR-terminated stream format */
/* file organization */
#define FAT$C_SEQUENTIAL 0	/* sequential organization */
#define FAT$C_RELATIVE	1	/* relative organization */
#define FAT$C_INDEXED	2	/* indexed organization */
#define FAT$C_DIRECT	3	/* direct organization */
/* record attributes */
#define FAT$V_FORTRANCC 0
#define FAT$V_IMPLIEDCC 1
#define FAT$V_PRINTCC	2
#define FAT$V_NOSPAN	3
#define FAT$V_MSBRCW	4
#define FAT$M_FORTRANCC (1<<FAT$V_FORTRANCC)	/* 0x01 */
#define FAT$M_IMPLIEDCC (1<<FAT$V_IMPLIEDCC)	/* 0x02 */
#define FAT$M_PRINTCC	(1<<FAT$V_PRINTCC)	/* 0x04 */
#define FAT$M_NOSPAN	(1<<FAT$V_NOSPAN)	/* 0x08 */
#define FAT$M_MSBRCW	(1<<FAT$V_MSBRCW)	/* 0x10 */

#define FAT$S_RTYPE	4
#define FAT$S_FILEORG	4

#define FAT$K_LENGTH	32
#define FAT$C_LENGTH	32
#define FAT$S_FATDEF	32
struct fatdef {
    union {
	unsigned char fat$b_rtype;		/* record type */
	struct {
	    unsigned fat$v_rtype   : 4;		/* record type subfield */
	    unsigned fat$v_fileorg : 4;		/* file organization */
	} fat$r_rtype_bits;
    } fat$r_rtype_overlay;
    union {
	unsigned char fat$b_rattrib;		/* record attributes */
	struct {
	    unsigned fat$v_fortrancc : 1;	/* Fortran carriage control */
	    unsigned fat$v_impliedcc : 1;	/* implied carriage control */
	    unsigned fat$v_printcc   : 1;	/* print file carriage control */
	    unsigned fat$v_nospan    : 1;	/* no spanned records */
	    unsigned fat$v_msbrcw    : 1;	/* format of RCW (0=LSB, 1=MSB) */
	    unsigned		     : 3;	/* padding */
	} fat$r_rattrib_bits;
    } fat$r_rattrib_overlay;
    unsigned short fat$w_rsize;		/* record size in bytes */
    union {
	unsigned long fat$l_hiblk;		/* highest allocated VBN */
	struct {
	    unsigned short fat$w_hiblkh;	/* high order word */
	    unsigned short fat$w_hiblkl;	/* low order word */
	} fat$r_hiblk_fields;
    } fat$r_hiblk_overlay;
    union {
	unsigned long fat$l_efblk;		/* end of file VBN */
	struct {
	    unsigned short fat$w_efblkh;	/* high order word */
	    unsigned short fat$w_efblkl;	/* low order word */
	} fat$r_efblk_fields;
    } fat$r_efblk_overlay;
    unsigned short fat$w_ffbyte;	/* first free byte in EFBLK */
    unsigned char fat$b_bktsize;	/* bucket size in blocks */
    unsigned char fat$b_vfcsize;	/* size in bytes of fixed length control for VFC records */
    unsigned short fat$w_maxrec;	/* maximum record size in bytes */
    unsigned short fat$w_defext;	/* default extend quantity */
    unsigned short fat$w_gbc;		/* global buffer count */
    unsigned	: 16, : 16, : 16, : 16; /* short fill[4]; spare */
    unsigned short fat$w_versions;	/* default version limit for directory file */
};

#endif	/*_FATDEF_H*/
