/************************************************************************/
/*                                                                      */
/* Copyright (c) 1988 -                                                 */
/*     The Rector and Visitors of the University of Virginia            */
/*                                                                      */
/* This code may not be distributed further without permission          */
/*      from the University of Virginia.                                */
/* This code is distributed WITHOUT ANY WARRANTY.  No claims are        */
/*      made as to whether it serves any particular purpose or even     */
/*      works at all.                                                   */
/*                                                                      */
/************************************************************************/

/* basic data types (most unused by Pascal) */

# define TW_UNDEF  0
# define TW_VOID   1
# define TW_CHAR   2  /* char */
# define TW_SHORT  3
# define TW_INT    4  /* integer, enumerations, boolean */
# define TW_LONG   5
# define TW_FLOAT  6
# define TW_DOUBLE 7  /* real */
# define TW_STRTY  8  /* record types, file types, set types */
# define TW_UNION  9
# define TW_ENUM   10
# define TW_MOE    11
# define TW_UCHAR  12
# define TW_USHORT 13
# define TW_UINT   14
# define TW_ULING  15

/* operators for building structured types */

# define TW_PTR  020	/* pointer to */
# define TW_FTN  040	/* function returning */
# define TW_ARY  060	/* array of */

/* type packing constants */

# define TW_MASK 060	/* type operator mask */
# define TW_BMASK 017	/* basic type mask */
# define TW_SHIFT 2		/* size in bits of type operator */

/*	macros for manipulating types */

# define TW_BTYPE(x) ((x) & TW_BMASK)   /* basic type of x */
# define TW_ISPTR(x) (((x) & TW_MASK) == TW_PTR) /* is x a pointer  */
# define TW_ISFTN(x) (((x) & TW_MASK) == TW_FTN) /* is x a function */
# define TW_ISARY(x) (((x) & TW_MASK) == TW_ARY) /* is x an array   */

/* convert x to pointer-to-x */

# define TW_INCREF(x) ((((x) & ~TW_BMASK) << TW_SHIFT) | TW_PTR | \
	((x) & TW_BMASK))

/* convert pointer-/function-/array- of-x to x */

# define TW_DECREF(x) ((((x) >> TW_SHIFT) & ~TW_BMASK) | ((x) & TW_BMASK))
