new version from Chris Torek
[unix-history] / usr / src / old / pcc / mip / manifest
/* manifest 4.3 85/01/18 */
# include <stdio.h>
/* manifest constant file for the lex/yacc interface */
# define ERROR 1
# define NAME 2
# define STRING 3
# define ICON 4
# define FCON 5
# define DCON 6
# define PLUS 9
# define MINUS 11
# define MUL 14
# define AND 17
# define OR 20
# define ER 22
# define QUEST 24
# define COLON 25
# define ANDAND 26
# define OROR 27
/* the defines for ASOP, RELOP, EQUOP, DIVOP,
SHIFTOP, ICOP, UNOP, and STROP have been
moved to mfile1 */
/* reserved words, etc */
# define TYPE 36
# define CLASS 37
# define STRUCT 38
# define RETURN 39
# define GOTO 40
# define IF 41
# define ELSE 42
# define SWITCH 43
# define BREAK 44
# define CONTINUE 45
# define WHILE 46
# define DO 47
# define FOR 48
# define DEFAULT 49
# define CASE 50
# define SIZEOF 51
# define ENUM 52
/* little symbols, etc. */
/* namely,
LP (
RP )
LC {
RC }
LB [
RB ]
CM ,
SM ;
*/
/* These defines are being moved to mfile1
to alleviate preprocessor problems with
second pass files: LP, RP, LC, RC */
# define LB 57
# define RB 58
# define CM 59
# define SM 60
# define ASSIGN 61
/* END OF YACC */
/* left over tree building operators */
#define COMOP 62 /* , operator */
#define DIV 63 /* / */
#define MOD 65 /* % */
#define LS 67 /* << */
#define RS 69 /* >> */
#define DOT 71 /* . */
#define STREF 72 /* -> */
#define CALL 73 /* C function call */
#define FORTCALL 76 /* Fortran function call */
#define NOT 79 /* ! */
#define COMPL 80 /* ~ */
#define INCR 81 /* ++ */
#define DECR 82 /* -- */
#define EQ 83 /* == */
#define NE 84 /* != */
#define LE 85 /* <= */
#define LT 86 /* < */
#define GE 87 /* >= */
#define GT 88 /* > */
#define ULE 89 /* unsigned <= */
#define ULT 90 /* unsigned < */
#define UGE 91 /* unsigned >= */
#define UGT 92 /* unsigned > */
#define SETBIT 93 /* unused */
#define TESTBIT 94 /* unused */
#define RESETBIT 95 /* unused */
#define ARS 96 /* arithmetic >> */
#define REG 97 /* register */
#define OREG 98 /* offset from register */
#define CCODES 99 /* condition codes */
#define FREE 100 /* free node */
#define STASG 101 /* structure assignment */
#define STARG 102 /* structure parameter */
#define STCALL 103 /* call to function returning structure */
/* some conversion operators */
#define FLD 106 /* field */
#define SCONV 107 /* storage conversion */
#define PCONV 108 /* pointer conversion */
#define PMCONV 109 /* pointer multiply conversion (from +) */
#define PVCONV 110 /* pointer divide conversion (from -) */
/* special node operators, used for special contexts */
#define FORCE 111 /* force result, for return values */
#define CBRANCH 112 /* condition branch */
#define INIT 113 /* data initialization */
#define CAST 114 /* type cast */
/* node types */
# define LTYPE 02
# define UTYPE 04
# define BITYPE 010
/* DSIZE is the size of the dope array */
# define DSIZE CAST+1
/* type names, used in symbol table building */
# define TNULL PTR /* pointer to UNDEF */
# define TVOID FTN /* function returning UNDEF (for void) */
# define UNDEF 0
# define FARG 1
# define CHAR 2
# define SHORT 3
# define INT 4
# define LONG 5
# define FLOAT 6
# define DOUBLE 7
# define STRTY 8
# define UNIONTY 9
# define ENUMTY 10
# define MOETY 11
# define UCHAR 12
# define USHORT 13
# define UNSIGNED 14
# define ULONG 15
# define ASG 1+
# define UNARY 2+
# define NOASG (-1)+
# define NOUNARY (-2)+
/* various flags */
# define NOLAB (-1)
/* type modifiers */
# define PTR 020
# define FTN 040
# define ARY 060
/* type packing constants */
# define TMASK 060
# define TMASK1 0300
# define TMASK2 0360
# define BTMASK 017
# define BTSHIFT 4
# define TSHIFT 2
/* macros */
# define MODTYPE(x,y) x = ( (x)&(~BTMASK))|(y) /* set basic type of x to y */
# define BTYPE(x) ( (x)&BTMASK) /* basic type of x */
# define ISUNSIGNED(x) ((x)<=ULONG&&(x)>=UCHAR)
# define UNSIGNABLE(x) ((x)<=LONG&&(x)>=CHAR)
# define ENUNSIGN(x) ((x)+(UNSIGNED-INT))
# define DEUNSIGN(x) ((x)+(INT-UNSIGNED))
# define ISPTR(x) (( (x)&TMASK)==PTR)
# define ISFTN(x) (( (x)&TMASK)==FTN) /* is x a function type */
# define ISARY(x) (( (x)&TMASK)==ARY) /* is x an array type */
# define INCREF(x) ((( (x)&~BTMASK)<<TSHIFT)|PTR|( (x)&BTMASK))
# define DECREF(x) ((( (x)>>TSHIFT)&~BTMASK)|( (x)&BTMASK))
# define SETOFF(x,y) if( (x)%(y) != 0 ) (x) = ( ((x)/(y) + 1) * (y))
/* advance x to a multiple of y */
# define NOFIT(x,y,z) ( ( (x)%(z) + (y) ) > (z) )
/* can y bits be added to x without overflowing z */
/* pack and unpack field descriptors (size and offset) */
# define PKFIELD(s,o) (( (o)<<6)| (s) )
# define UPKFSZ(v) ( (v) &077)
# define UPKFOFF(v) ( (v) >>6)
/* operator information */
# define TYFLG 016
# define ASGFLG 01
# define LOGFLG 020
# define SIMPFLG 040
# define COMMFLG 0100
# define DIVFLG 0200
# define FLOFLG 0400
# define LTYFLG 01000
# define CALLFLG 02000
# define MULFLG 04000
# define SHFFLG 010000
# define ASGOPFLG 020000
# define SPFLG 040000
#define optype(o) (dope[o]&TYFLG)
#define asgop(o) (dope[o]&ASGFLG)
#define logop(o) (dope[o]&LOGFLG)
#define callop(o) (dope[o]&CALLFLG)
/* table sizes */
# define TREESZ 1000
#ifndef FLEXNAMES
# define NCHNAM 8 /* number of characters in a name */
#else
char *hash();
char *savestr();
char *tstr();
extern int tstrused;
extern char *tstrbuf[], **curtstr;
#define freetstr() curtstr = tstrbuf, tstrused = 0
#endif
/* common defined variables */
extern int nerrors; /* number of errors seen so far */
typedef union ndu NODE;
typedef unsigned int TWORD;
# define NIL (NODE *)0
extern int dope[]; /* a vector containing operator information */
extern char *opst[]; /* a vector containing names for ops */
# ifdef ONEPASS
/* in one-pass operation, define the tree nodes */
union ndu {
struct {
int op;
int rall;
TWORD type;
int su;
#ifndef FLEXNAMES
char name[NCHNAM];
#else
char *name;
int stalign;
#endif
NODE *left;
NODE *right;
}in; /* interior node */
struct {
int op;
int rall;
TWORD type;
int su;
#ifndef FLEXNAMES
char name[NCHNAM];
#else
char *name;
int stalign;
#endif
CONSZ lval;
int rval;
}tn; /* terminal node */
struct {
int op, rall;
TWORD type;
int su;
int label; /* for use with branching */
}bn; /* branch node */
struct {
int op, rall;
TWORD type;
int su;
int stsize; /* sizes of structure objects */
int stalign; /* alignment of structure objects */
}stn; /* structure node */
struct {
int op;
int cdim;
TWORD type;
int csiz;
}fn; /* front node */
struct {
/* this structure is used when a single precision constant
is being computed */
int op;
int cdim;
TWORD type;
int csiz;
float fval;
}fpn; /* FCON node */
struct {
/* this structure is used when a double precision constant
is being computed */
int op;
int cdim;
TWORD type;
int csiz;
double dval;
}dpn; /* DCON node */
};
# endif
# ifdef BUG2
# define BUG1
# endif
# ifdef BUG3
# define BUG2
# define BUG1
# endif
# ifdef BUG4
# define BUG1
# define BUG2
# define BUG3
# endif
# ifndef ONEPASS
# ifndef EXPR
# define EXPR '.'
# endif
# ifndef BBEG
# define BBEG '['
# endif
# ifndef BEND
# define BEND ']'
# endif
# endif