Mercurial > hg > CbC > old > device
comparison mc.h @ 164:1c2a9232ea93
mc.h generation
author | kono |
---|---|
date | Mon, 24 Nov 2003 09:29:06 +0900 |
parents | 0c604d2ff585 |
children | 6409ff6bc219 |
comparison
equal
deleted
inserted
replaced
163:fc8514c9d685 | 164:1c2a9232ea93 |
---|---|
8 #else | 8 #else |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #endif | 10 #endif |
11 | 11 |
12 #define SIZE_INT 4 | 12 #define SIZE_INT 4 |
13 | |
14 /* reserved word start */ | |
13 | 15 |
14 #define INT (-1) | 16 #define INT (-1) |
15 #define UNSIGNED (-2) | 17 #define UNSIGNED (-2) |
16 #define CHAR (-3) | 18 #define CHAR (-3) |
17 #define UCHAR (-4) | 19 #define UCHAR (-4) |
36 #define DEFAULT (-22) | 38 #define DEFAULT (-22) |
37 #define RESERVE (-23) | 39 #define RESERVE (-23) |
38 #define TAG (-24) | 40 #define TAG (-24) |
39 #define FIELD (-25) | 41 #define FIELD (-25) |
40 #define IDENT (-26) | 42 #define IDENT (-26) |
41 #define STRING (-27) | 43 #define MACRO (-27) |
42 #define MACRO (-28) | 44 #define BLABEL (-28) |
43 #define BLABEL (-29) | 45 #define FLABEL (-29) |
44 #define FLABEL (-30) | 46 #define TYPEDEF (-30) |
45 #define TYPEDEF (-31) | 47 #define SIZEOF (-31) |
46 #define SIZEOF (-32) | 48 #define TYPE (-32) |
47 #define TYPE (-33) | 49 #define LONG (-33) |
48 #define LONG (-34) | 50 #define ULONG (-34) |
49 #define ULONG (-35) | 51 #define SHORT (-35) |
50 #define SHORT (-36) | 52 #define USHORT (-36) |
51 #define USHORT (-37) | 53 #define EXTRN (-37) |
52 #define EXTRN (-38) | 54 #define EXTRN1 (-38) |
53 #define EXTRN1 (-39) | 55 #define VOID (-39) |
54 #define VOID (-40) | 56 #define REGISTER (-40) |
55 #define REGISTER (-41) | 57 #define CODE (-41) |
56 #define CODE (-42) | 58 #define ENVIRONMENT (-42) |
57 #define ENVIRONMENT (-43) | 59 #define DEFINED (-43) |
58 #define DEFINED (-44) | 60 #define KONST (-44) |
59 #define KONST (-45) | 61 #define FMACRO (-45) |
60 #define FMACRO (-46) | 62 #define LMACRO (-46) |
61 #define LMACRO (-47) | 63 #define DOTS (-47) |
62 #define DOTS (-49) | 64 |
63 | 65 #define FLOAT (-48) |
64 #define FLOAT (-50) | 66 #define DOUBLE (-49) |
65 #define DOUBLE (-51) | 67 #define FREGISTER (-50) |
66 #define FREGISTER (-52) | 68 #define DREGISTER (-51) |
67 #define DREGISTER (-53) | 69 #define LONGLONG (-52) |
68 #define LONGLONG (-54) | 70 #define ULONGLONG (-53) |
69 #define ULONGLONG (-55) | 71 |
72 /* reserved word end */ | |
70 | 73 |
71 #define EMPTY (-99) | 74 #define EMPTY (-99) |
72 | 75 |
76 /* mode start */ | |
73 #define TOP 0 | 77 #define TOP 0 |
74 #define GDECL 1 | 78 #define GDECL 1 |
75 #define GSDECL 2 | 79 #define GSDECL 2 |
76 #define GUDECL 3 | 80 #define GUDECL 3 |
77 #define ADECL 4 | 81 #define ADECL 4 |
82 #define STAT 9 | 86 #define STAT 9 |
83 #define GTDECL 10 | 87 #define GTDECL 10 |
84 #define LTDECL 11 | 88 #define LTDECL 11 |
85 #define IFDEF 12 | 89 #define IFDEF 12 |
86 #define MDECL 13 | 90 #define MDECL 13 |
91 /* mode end */ | |
92 | |
93 #define US 1 | |
94 #define AS 1000 | |
95 #define SOP 200 | |
96 #define DOP 400 | |
97 #define FOP 600 | |
98 #define LOP 800 | |
99 | |
100 /* tree node tags start */ | |
101 | |
102 #define LIST_ARGS(i) (i==FUNCTION||i==CODE) | |
103 | |
104 /* nullary argments */ | |
87 | 105 |
88 #define GVAR 1 | 106 #define GVAR 1 |
89 #define RGVAR 2 | 107 #define RGVAR 2 |
90 #define CRGVAR 3 | 108 #define CRGVAR 3 |
91 #define CURGVAR 4 | 109 #define CURGVAR 4 |
92 #define LVAR 5 | 110 #define LVAR 5 |
93 #define RLVAR 6 | 111 #define RLVAR 6 |
94 #define CRLVAR 7 | 112 #define CRLVAR 7 |
95 #define CURLVAR 8 | 113 #define CURLVAR 8 |
114 #define FRGVAR (FOP+RGVAR) | |
115 #define FRLVAR (FOP+RLVAR) | |
116 #define DRGVAR (DOP+RGVAR) | |
117 #define DRLVAR (DOP+RLVAR) | |
118 #define SRGVAR (SOP+RGVAR) | |
119 #define SRLVAR (SOP+RLVAR) | |
120 #define SURGVAR (SOP+CURGVAR) | |
121 #define SURLVAR (SOP+CURLVAR) | |
122 #define LRGVAR (LOP+RGVAR) | |
123 #define LRLVAR (LOP+RLVAR) | |
124 #define LURGVAR (LOP+CURGVAR) | |
125 #define LURLVAR (LOP+CURLVAR) | |
126 | |
96 #define CONST 9 | 127 #define CONST 9 |
97 #define FNAME 10 | 128 #define DCONST (DOP+CONST) |
98 #define INDIRECT 11 | 129 #define FCONST (FOP+CONST) |
99 #define RINDIRECT 12 | 130 #define LCONST (LOP+CONST) |
100 #define CRINDIRECT 13 | 131 #define STRING 10 |
101 #define CURINDIRECT 14 | 132 #define FNAME 11 |
102 #define ADDRESS 15 | 133 |
103 #define MINUS 16 | 134 #define NULLARY_ARGS(i) (GVAR<=(i%SOP)&&(i%SOP)<=FNAME) |
104 #define LNOT 17 | 135 |
105 #define BNOT 18 | 136 /* unary argments */ |
106 #define INC 19 | 137 |
107 #define POSTINC 20 | 138 #define ADDRESS 12 |
108 #define PREINC 21 | 139 #define MINUS 13 |
109 #define CPOSTINC 22 | 140 #define LNOT 14 |
110 #define CPREINC 23 | 141 #define BNOT 15 |
142 #define INC 16 | |
143 #define POSTINC 17 | |
144 #define PREINC 18 | |
145 #define DEC 19 | |
146 #define CPOSTINC 20 | |
147 #define CPREINC 21 | |
148 #define CPOSTDEC 22 | |
149 #define CPREDEC 23 | |
111 #define CUPOSTINC 24 | 150 #define CUPOSTINC 24 |
112 #define CUPREINC 25 | 151 #define CUPREINC 25 |
113 #define DEC 26 | 152 #define CUPOSTDEC 26 |
114 #define CPOSTDEC 27 | 153 #define CUPREDEC 27 |
115 #define CPREDEC 28 | 154 #define SPOSTINC (SOP+CPOSTINC) |
116 #define CUPOSTDEC 29 | 155 #define SPREINC (SOP+CPREINC) |
117 #define CUPREDEC 30 | 156 #define SPOSTDEC (SOP+CPOSTDEC) |
118 #define MUL 31 | 157 #define SPREDEC (SOP+CPREDEC) |
119 #define UMUL 32 | 158 #define SUPOSTINC (SOP+CUPOSTINC) |
120 #define DIV 33 | 159 #define SUPREINC (SOP+CUPREINC) |
121 #define UDIV 34 | 160 #define SUPOSTDEC (SOP+CUPOSTDEC) |
122 #define MOD 35 | 161 #define SUPREDEC (SOP+CUPREDEC) |
123 #define UMOD 36 | 162 #define FPOSTINC (FOP+POSTINC) |
124 #define ADD 37 | 163 #define FPREINC (FOP+PREINC) |
125 #define SUB 38 | 164 #define DPOSTINC (DOP+POSTINC) |
126 #define CMP 39 | 165 #define DPREINC (DOP+PREINC) |
127 #define RSHIFT 40 | 166 #define LPOSTINC (LOP+POSTINC) |
128 #define URSHIFT 41 | 167 #define LPREINC (LOP+PREINC) |
129 #define LSHIFT 42 | 168 #define LUPOSTINC (LOP+CUPOSTINC) |
130 #define ULSHIFT 43 | 169 #define LUPREINC (LOP+CUPREINC) |
131 #define GT 44 | 170 #define INDIRECT 28 |
132 #define UGT 45 | 171 #define RINDIRECT 29 |
133 #define GE 46 | 172 #define CRINDIRECT 30 |
134 #define UGE 47 | 173 #define CURINDIRECT 31 |
135 #define LT 48 | 174 #define SRINDIRECT (SOP+CRINDIRECT) |
136 #define ULT 49 | 175 #define SURINDIRECT (SOP+CURINDIRECT) |
137 #define LE 50 | 176 #define FRINDIRECT (FOP+RINDIRECT) |
138 #define ULE 51 | 177 #define DRINDIRECT (DOP+RINDIRECT) |
139 #define EQ 52 | 178 #define LRINDIRECT (DOP+RINDIRECT) |
140 #define NEQ 53 | 179 #define RSTRUCT 32 |
141 #define BAND 54 | 180 #define CONV 33 |
142 #define EOR 55 | 181 |
143 #define BOR 56 | 182 #define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV) |
144 #define LAND 57 | 183 |
145 #define LOR 58 | 184 /* binary argments */ |
146 #define COND 59 | 185 |
147 #define ASS 60 | 186 #define MUL 34 |
148 #define CASS 61 | 187 #define UMUL 35 |
149 #define ASSOP 62 | 188 #define DIV 36 |
150 #define CASSOP 63 | 189 #define UDIV 37 |
151 #define CUASSOP 64 | 190 #define MOD 38 |
191 #define UMOD 39 | |
192 #define ADD 40 | |
193 #define SUB 41 | |
194 #define CMP 42 | |
195 #define RSHIFT 43 | |
196 #define URSHIFT 44 | |
197 #define LSHIFT 45 | |
198 #define ULSHIFT 46 | |
199 #define GT 47 | |
200 #define UGT 48 | |
201 #define GE 49 | |
202 #define UGE 50 | |
203 #define LT 51 | |
204 #define ULT 52 | |
205 #define LE 53 | |
206 #define ULE 54 | |
207 #define EQ 55 | |
208 #define NEQ 56 | |
209 #define BAND 57 | |
210 #define EOR 58 | |
211 #define BOR 59 | |
212 #define LAND 60 | |
213 #define LOR 61 | |
214 #define ASS 62 | |
215 #define CMPGE 63 | |
216 #define ASSOP 64 | |
152 #define COMMA 65 | 217 #define COMMA 65 |
153 #define LPAR 66 | 218 |
154 #define RPAR 67 | 219 #define CASS 66 |
155 #define LBRA 68 | 220 #define CASSOP 67 |
156 #define RBRA 69 | 221 #define CUASSOP 68 |
157 #define LC 70 | 222 |
158 #define RC 71 | 223 #define SASS (SOP+ASS) |
159 #define COLON 72 | 224 #define SASSOP (SOP+CASSOP) |
160 #define SM 73 | 225 #define SUASSOP (SOP+CUASSOP) |
161 #define PERIOD 74 | 226 |
162 #define ARROW 75 | 227 #define DASS (DOP+ASS) |
163 #define CNAME 76 | 228 #define DCMPGE (DOP+CMPGE) |
164 #define SASS 77 | |
165 #define RSTRUCT 78 | |
166 | |
167 #define DASSOP (DOP+ASSOP) | 229 #define DASSOP (DOP+ASSOP) |
168 #define DCMP (DOP+CMP) | 230 #define DCMP (DOP+CMP) |
169 #define DMINUS (DOP+MINUS) | 231 #define DMINUS (DOP+MINUS) |
170 #define DMUL (DOP+MUL) | 232 #define DMUL (DOP+MUL) |
171 #define DDIV (DOP+DIV) | 233 #define DDIV (DOP+DIV) |
172 #define DADD (DOP+ADD) | 234 #define DADD (DOP+ADD) |
173 #define DSUB (DOP+SUB) | 235 #define DSUB (DOP+SUB) |
236 | |
237 #define FASS (FOP+ASS) | |
238 #define FCMPGE (FOP+CMPGE) | |
174 #define FASSOP (FOP+ASSOP) | 239 #define FASSOP (FOP+ASSOP) |
175 #define FCMP (FOP+CMP) | 240 #define FCMP (FOP+CMP) |
176 #define FMINUS (FOP+MINUS) | 241 #define FMINUS (FOP+MINUS) |
177 #define FMUL (FOP+MUL) | 242 #define FMUL (FOP+MUL) |
178 #define FDIV (FOP+DIV) | 243 #define FDIV (FOP+DIV) |
179 #define FADD (FOP+ADD) | 244 #define FADD (FOP+ADD) |
180 #define FSUB (FOP+SUB) | 245 #define FSUB (FOP+SUB) |
181 #define CMPGE 79 | 246 |
182 #define DCMPGE (DOP+CMPGE) | 247 #define LASS (LOP+ASS) |
183 #define FCMPGE (FOP+CMPGE) | 248 #define LCMPGE (LOP+CMPGE) |
184 #define LMUL 80 | 249 #define LASSOP (LOP+CASSOP) |
185 #define LDIV 81 | 250 #define LUASSOP (LOP+CUASSOP) |
186 #define LADD 82 | 251 #define LMUL (LOP+MUL) |
187 #define LSUB 83 | 252 #define LDIV (LOP+DIV) |
188 | 253 #define LUMUL (LOP+UMUL) |
189 #define FRGVAR 84 | 254 #define LUDIV (LOP+UDIV) |
190 #define FRLVAR 85 | 255 #define LADD (LOP+ADD) |
191 #define FRINDIRECT 86 | 256 #define LSUB (LOP+SUB) |
192 #define DRGVAR 87 | 257 |
193 #define DRLVAR 88 | 258 #define STASS 69 |
194 #define DRINDIRECT 90 | 259 |
195 #define LRGVAR 91 | 260 #define BINARY_ARGS(i) (MUL<=(i%SOP)&&(i%SOP)<=STASS) |
196 #define LRLVAR 92 | 261 |
197 #define LRINDIRECT 93 | 262 /* tarnary argments */ |
198 #define DCONST (DOP+CONST) | 263 |
199 #define FCONST (FOP+CONST) | 264 #define COND 70 |
200 #define LCONST 94 | 265 #define SCOND (SOP+COND) |
201 #define DASS 95 | |
202 #define FASS 96 | |
203 #define LASS 97 | |
204 #define SHASS 98 | |
205 | |
206 #define I2D 99 | |
207 #define D2I 100 | |
208 #define U2D 101 | |
209 #define D2U 102 | |
210 #define F2D 103 | |
211 #define D2F 104 | |
212 #define I2F 105 | |
213 #define F2I 106 | |
214 #define U2F 107 | |
215 #define F2U 108 | |
216 #define FPOSTINC (FOP+POSTINC) | |
217 #define DPOSTINC (DOP+POSTINC) | |
218 #define FPREINC (FOP+PREINC) | |
219 #define DPREINC (DOP+PREINC) | |
220 #define DCOND (DOP+COND) | 266 #define DCOND (DOP+COND) |
221 #define FCOND (FOP+COND) | 267 #define FCOND (FOP+COND) |
222 #define CONV 109 | 268 #define LCOND (LOP+COND) |
223 | 269 |
224 #define US 1 | 270 #define TARNARY_ARGS(i) (COND==(i%SOP)) |
225 #define AS 200 | 271 |
226 #define DOP 400 | 272 /* not appeared as tags */ |
227 #define FOP 600 | 273 |
274 #define I2D 71 | |
275 #define D2I 72 | |
276 #define U2D 73 | |
277 #define D2U 74 | |
278 #define F2D 75 | |
279 #define D2F 76 | |
280 #define I2F 77 | |
281 #define F2I 78 | |
282 #define U2F 79 | |
283 #define F2U 80 | |
284 | |
285 #define LPAR 81 | |
286 #define RPAR 82 | |
287 #define LBRA 83 | |
288 #define RBRA 84 | |
289 #define LC 85 | |
290 #define RC 86 | |
291 #define COLON 87 | |
292 #define SM 88 | |
293 #define PERIOD 89 | |
294 #define ARROW 90 | |
295 #define CNAME 91 | |
296 | |
297 /* tree node tags end */ | |
298 | |
299 /* error number start */ | |
228 | 300 |
229 #define FILERR 1 | 301 #define FILERR 1 |
230 #define DCERR 2 | 302 #define DCERR 2 |
231 #define STERR 3 | 303 #define STERR 3 |
232 #define EXERR 4 | 304 #define EXERR 4 |
245 #define UDERR 17 | 317 #define UDERR 17 |
246 #define OPTION 18 | 318 #define OPTION 18 |
247 #define REG_ERR 19 | 319 #define REG_ERR 19 |
248 #define CODE_ERR 20 | 320 #define CODE_ERR 20 |
249 #define MSERR 21 | 321 #define MSERR 21 |
322 /* error number end */ | |
250 | 323 |
251 #define GSYMS 9000 | 324 #define GSYMS 9000 |
252 #define LSYMS 500 | 325 #define LSYMS 500 |
253 #define MSYMS 3000 | 326 #define MSYMS 3000 |
254 | 327 |