xref: /original-bsd/usr.bin/pascal/src/pcops.h (revision 829e4995)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 /* static	char sccsid[] = "@(#)pcops.h 2.1 02/08/84"; */
4 
5     /*
6      *	tree node operators
7      */
8 #define	P2UNDEFINED	1
9 #define	P2NAME		2
10 #define	P2STRING	3
11 #define	P2ICON		4
12 #define	P2FCON		5
13 #define	P2PLUS		6
14 #define	P2MINUS		8		/* also unary == P2NEG */
15 #define	P2MUL		11		/* also unary == P2INDIRECT */
16 #define	P2AND		14		/* also unary */
17 #define	P2OR		17
18 #define	P2ER		19
19 #define	P2QUEST		21
20 #define	P2COLON		22
21 #define	P2ANDAND	23
22 #define	P2OROR		24
23     /*
24      *	yacc operator classes, reserved words, little symbols, etc.
25      *	operators 25 .. 57 not used, except 56
26      */
27 #define P2LISTOP	56
28 #define	P2ASSIGN	58
29 #define	P2COMOP		59
30 #define	P2DIV		60
31 #define	P2MOD		62
32 #define	P2LS		64
33 #define	P2RS		66
34 #define	P2DOT		68
35 #define	P2STREF		69
36 #define	P2CALL		70		/* also unary */
37 #define	P2FORTCALL	73		/* also unary */
38 #define	P2NOT		76
39 #define	P2COMPL		77
40 #define	P2INCR		78
41 #define	P2DECR		79
42 #define	P2EQ		80
43 #define	P2NE		81
44 #define	P2LE		82
45 #define	P2LT		83
46 #define	P2GE		84
47 #define	P2GT		85
48 #define	P2ULE		86
49 #define	P2ULT		87
50 #define	P2UGE		88
51 #define	P2UGT		89
52 #define	P2SETBIT	90
53 #define	P2TESTBIT	91
54 #define	P2RESETBIT	92
55 #define	P2ARS		93
56 #define	P2REG		94
57 #define	P2OREG		95
58 #define	P2CCODES	96
59 #define	P2FREE		97
60 #define	P2STASG		98
61 #define	P2STARG		99
62 #define	P2STCALL	100		/* also unary */
63 
64     /*
65      *	some conversion operators
66      */
67 #define	P2FLD		103
68 #define	P2SCONV		104
69 #define	P2PCONV		105
70 #define	P2PMCONV	106
71 #define	P2PVCONV	107
72 
73     /*
74      *	special node operators, used for special contexts
75      */
76 #define	P2FORCE		108
77 #define	P2CBRANCH	109
78 #define	P2INIT		110
79 #define	P2CAST		111
80 
81     /*
82      *	prefix unary operator modifier
83      */
84 #define	P2ASG		1+
85 #define	P2UNARY		2+
86 
87     /*
88      *	these borrowed from /usr/src/cmd/mip/fort.c
89      *	to use the binary interface.
90      *	only FTEXT, FEXPR, FLBRAC, FRBRAC, and FEOF are used
91      */
92 #define	P2FTEXT		200
93 #define	P2FEXPR		201
94 #define	P2FLBRAC	203
95 #define	P2FRBRAC	204
96 #define	P2FEOF		205
97 
98     /*
99      *	type names
100      */
101 #define	P2UNDEF		0
102 #define	P2FARG		1
103 #define	P2CHAR		2
104 #define	P2SHORT		3
105 #define	P2INT		4	/* this is also used for booleans */
106 #define	P2LONG		5	/* don't use these, the second pass chokes */
107 #define	P2FLOAT		6
108 #define	P2DOUBLE	7
109 #define	P2STRTY		8
110 #define	P2UNIONTY	9
111 #define	P2ENUMTY	10
112 #define	P2MOETY		11
113 #define	P2UCHAR		12
114 #define	P2USHORT	13
115 #define	P2UNSIGNED	14
116 #define	P2ULONG		15
117 
118     /*
119      *	type modifiers
120      */
121 #define	P2PTR		020
122 #define	P2FTN		040
123 #define	P2ARY		060
124 
125     /*
126      *	see the comment for p2type for an explanation of c type words
127      */
128 #define	P2BASETYPE	017
129 #define	P2TYPESHIFT	2
130 
131     /*
132      *	add a most significant type modifier, m, to a type, t
133      */
134 #define ADDTYPE( t,m )	( ( ( ( t ) & ~P2BASETYPE ) << P2TYPESHIFT )	\
135 		  | ( m )						\
136 		  | ( ( t ) & P2BASETYPE ) )
137