vaxtypes_h
/*+ VAXTYPES
Module (VAXTYPES) of FERMI$LIB:LCLCDEF.TLB and file VAXTYPES.H.
This module defines some data types, constants and macros for use
with VAX-11 C under VAX/VMS. Note that using these definitions
renders the program "non-portable".
2 Constants
Defined constants for general VAX-11C usage:
TRUE conditional true value (1)
FALSE conditional false value (0)
EOF End-of-file flag (for standard I/O)
NULL Undefined pointer value (0)
MAX_... Maximum value for several data types:
int,ulong,short,uword,char,ubyte
MIN_... Minimum value for several data types which
may take on negative values:
int,short,char
2 Types
Additional types (or structures) for use with VAX-11 C
byte / ubyte signed / unsigned 8-bit byte
word / uword signed / unsigned 16-bit word
int / ulong signed / unsigned 32-bit longword
quad / uquad signed / unsigned 64-bit quadword
octa / uocta signed / unsigned 128-bit octaword
address general address (pointer to byte or char)
queue structure defining a queue header or the queue links
(fields flink and blink).
vmstime VMS-returned system time type (unsigned long long).
64 bit count of 100nSec ticks since 17 Nov 1858
For simplicity, [u]octa is defined as an array of long's
(or unsigned long's). See also $bit, $[u]field
under the "Macros" subtopic.
2 Macros
Macros defined for use with VAX-11 C under VMS
$VMS_SUCCESS(code) TRUE if the status code has a severity code of
success or informational (success indication).
$VMS_FAILURE(code) TRUE if the status code has a severity code of
warning, error or severe (error indication).
SIGNAL_FAILURE(code) if code has an error indication severity, then
call LIB$SIGNAL to signal the error.
ABORT_ON_FAILURE(code) if code has an error indication severity, then
call LIB$STOP to signal the error and abort.
RETURN_ON_FAILURE(code) if code has an error indication severity, then
exit the routine returning the status code (use
only in routines which return VMS status).
$bit(name) defines a single bit in a struct (unsigned)
$field(name,size) defines a bit field of "size" bits in a struct
$ufield(name,size) same as $field but for an unsigned field
$align align to next byte field in struct
$unused(size) unused field of "size" bits
-*/
/*
V1.0 08-Feb-83 FJN Created
V2.0 09-Feb-83 FJN Corrected and expanded
V3.0 22-Feb-83 FJN Changed names to be similar to VAX-11 PASCAL V2
V3.1 17-Apr-83 FJN Added $VMS... macros
V3.2 22-Jul-83 FJN Dropped $ from byte/ubyte, etc. types
V3.3 19-Sep-83 FJN Added macros $unused, SIGNAL_FAILURE, and
ABORT_ON_FAILURE
V3.4 01-Aug-85 FJN Added RETURN_ON_FAILURE
*/
#ifndef vaxtypes
#define vaxtypes 1 /* To invoke this procedure only once! */
#include <sys/types.h>
typedef char *address; /* General address */
typedef char byte; /* 8-bit signed byte */
typedef short word; /* 16-bit signed word */
/* typedef int long; */ /* 32-bit signed longword (already
defined by VAX-11 C */
typedef long long quad; /* 64-bit signed quadword */
typedef int octa[4]; /* 128-bit signed octaword */
typedef unsigned char ubyte; /* 8-bit unsigned byte */
typedef unsigned short uword; /* 16-bit unsigned word */
/*typedef unsigned long ulong; */ /* defined in <sys/types.h> */
typedef unsigned long long uquad; /* 64-bit unsigned quadword */
typedef unsigned int uocta[4]; /* 128-bit unsigned octaword */
typedef unsigned long long vmstime; /* Quadword with VMS time */
typedef struct {
short year;
short month;
short day;
short hour;
short minute;
short second;
short tick;
short ticks_per_sec;
} __attribute__((packed)) /* Added by the PACKINATOR(tm) */ rsx_time; /* RSX GTIM$ time format */
/*
Define shorthands for struct bit fields:
*/
#define $bit(name) unsigned name : 1 /* Single bit */
#define $field(name,size) int name : size /* Field of "size" bits */
#define $ufield(name,size) unsigned name : size /* Field of "size" bits */
#define $align unsigned : 0 /* Re-align on byte */
#define $unused(size) unsigned : size /* Unused "size" bit field */
/* Some (re-)definitions from STDIO module (used when STDIO is not called) */
#ifndef EOF
#define EOF (-1)
#endif
#ifndef TRUE /* this is defined in cnsparam.h and stdio.h */
#define TRUE 1
#endif
#ifndef FALSE /* this is defined in cnsparam.h and stdio.h */
#define FALSE 0
#endif
#ifndef NULL /* this is defined in cnsparam.h and stdio.h */
#define NULL 0
#endif
/* Define constants giving minimum and maximum values for various types */
#ifndef MAX_INT
#define MAX_INT 2147483647 /* Maximum value in signed longword */
#define MAX_ULONG 4294967295 /* Maximum value in unsigned int */
#define MAX_SHORT 32767 /* Maximum value in signed word */
#define MAX_UWORD 65535 /* Maximum value in unsigned word */
#define MAX_CHAR 127 /* Maximum value in signed byte */
#define MAX_UBYTE 255 /* Maximum value in unsigned byte */
#define MIN_INT -2147483648 /* Minimum value in signed longword */
#define MIN_SHORT -32768 /* Minimum value in signed word */
#define MIN_CHAR -128 /* Minimum value in signed byte */
#endif
/* Define macros used to provide quick test of VMS completion codes
and macros to signal or abort (signal and stop) on failure codes. */
#ifndef $VMS_SUCCESS
#define $VMS_SUCCESS(code) ((code) & 1) /* for success */
#define $VMS_FAILURE(code) (!$VMS_SUCCESS(code)) /* for failure */
/* Signal failure completion code */
#define SIGNAL_FAILURE(code) if ($VMS_FAILURE(code)) LIB$SIGNAL(code)
/* Abort on failure completion code */
#define ABORT_ON_FAILURE(code) if ($VMS_FAILURE(code)) LIB$STOP(code)
/* Return failure completion code */
#define RETURN_ON_FAILURE(code) if ($VMS_FAILURE(code)) return(code)
#endif
#endif
/*
End of VAXTYPES module
*/
Security, Privacy, Legal