0
|
1 /* Micro-C header file */
|
|
2
|
|
3 #define DEBUG error(-1)
|
|
4
|
|
5 /*#include "CCLIB.TXT" */
|
19
|
6 #ifdef __micro_c__
|
|
7 #include "stdio.h"
|
|
8 #else
|
|
9 #include <stdio.h>
|
|
10 #endif
|
0
|
11
|
|
12 #define SIZE_INT 4
|
|
13
|
|
14 #define INT (-1)
|
|
15 #define CHAR (-2)
|
|
16 #define UNSIGNED (-3)
|
|
17 #define POINTER (-4)
|
|
18 #define ARRAY (-5)
|
|
19 #define STRUCT (-6)
|
|
20 #define UNION (-7)
|
|
21 #define FUNCTION (-8)
|
|
22 #define EMPTY (-9)
|
|
23
|
|
24 #define STATIC (-10)
|
|
25 #define GOTO (-11)
|
|
26 #define RETURN (-12)
|
|
27 #define BREAK (-13)
|
|
28 #define CONTINUE (-14)
|
|
29 #define IF (-15)
|
|
30 #define ELSE (-16)
|
|
31 #define FOR (-17)
|
|
32 #define DO (-18)
|
|
33 #define WHILE (-19)
|
|
34 #define SWITCH (-20)
|
|
35 #define CASE (-21)
|
|
36 #define DEFAULT (-22)
|
|
37 #define RESERVE (-23)
|
|
38 #define TAG (-24)
|
|
39 #define FIELD (-25)
|
|
40 #define IDENT (-26)
|
|
41 #define STRING (-27)
|
|
42 #define MACRO (-28)
|
|
43 #define BLABEL (-29)
|
|
44 #define FLABEL (-30)
|
|
45 #define TYPEDEF (-31)
|
|
46 #define SIZEOF (-32)
|
|
47 #define TYPE (-33)
|
|
48 #define LONG (-34)
|
|
49 #define SHORT (-35)
|
|
50 #define EXTRN (-36)
|
|
51 #define VOID (-37)
|
|
52 #define REGISTER (-38)
|
|
53 #define CODE (-39)
|
|
54 #define ENVIRONMENT (-40)
|
18
|
55 #define DEFINED (-41)
|
20
|
56 #define KONST (-42)
|
28
|
57 #define FMACRO (-43)
|
|
58 #define LMACRO (-44)
|
67
|
59 #define DOTS (-45)
|
0
|
60
|
78
|
61 #define FLOAT (-46)
|
|
62 #define DOUBLE (-47)
|
|
63 #define LONGLONG (-48)
|
|
64
|
0
|
65 #define TOP 0
|
|
66 #define GDECL 1
|
|
67 #define GSDECL 2
|
|
68 #define GUDECL 3
|
|
69 #define ADECL 4
|
|
70 #define LDECL 5
|
|
71 #define LSDECL 6
|
|
72 #define LUDECL 7
|
|
73 #define STADECL 8
|
|
74 #define STAT 9
|
|
75 #define GTDECL 10
|
|
76 #define LTDECL 11
|
18
|
77 #define IFDEF 12
|
29
|
78 #define MDECL 13
|
0
|
79
|
|
80 #define GVAR 1
|
|
81 #define RGVAR 2
|
|
82 #define CRGVAR 3
|
|
83 #define LVAR 4
|
|
84 #define RLVAR 5
|
|
85 #define CRLVAR 6
|
|
86 #define CONST 7
|
|
87 #define FNAME 8
|
|
88 #define INDIRECT 9
|
|
89 #define RINDIRECT 10
|
|
90 #define CRINDIRECT 11
|
|
91 #define ADDRESS 12
|
|
92 #define MINUS 13
|
|
93 #define LNOT 14
|
|
94 #define BNOT 15
|
|
95 #define INC 16
|
|
96 #define POSTINC 17
|
|
97 #define PREINC 18
|
|
98 #define CPOSTINC 19
|
|
99 #define CPREINC 20
|
|
100 #define DEC 21
|
|
101 #define CPOSTDEC 22
|
|
102 #define CPREDEC 23
|
|
103 #define MUL 24
|
|
104 #define UMUL 25
|
|
105 #define DIV 26
|
|
106 #define UDIV 27
|
|
107 #define MOD 28
|
|
108 #define UMOD 29
|
|
109 #define ADD 30
|
|
110 #define SUB 31
|
|
111 #define RSHIFT 32
|
|
112 #define URSHIFT 33
|
|
113 #define LSHIFT 34
|
|
114 #define ULSHIFT 35
|
|
115 #define GT 36
|
|
116 #define UGT 37
|
|
117 #define GE 38
|
|
118 #define UGE 39
|
|
119 #define LT 40
|
|
120 #define ULT 41
|
|
121 #define LE 42
|
|
122 #define ULE 43
|
|
123 #define EQ 44
|
|
124 #define NEQ 45
|
|
125 #define BAND 46
|
|
126 #define EOR 47
|
|
127 #define BOR 48
|
|
128 #define LAND 49
|
|
129 #define LOR 50
|
|
130 #define COND 51
|
|
131 #define ASS 52
|
|
132 #define CASS 53
|
|
133 #define ASSOP 54
|
|
134 #define CASSOP 55
|
|
135 #define COMMA 56
|
|
136 #define LPAR 57
|
|
137 #define RPAR 58
|
|
138 #define LBRA 59
|
|
139 #define RBRA 60
|
|
140 #define LC 61
|
|
141 #define RC 62
|
|
142 #define COLON 63
|
|
143 #define SM 64
|
|
144 #define PERIOD 65
|
|
145 #define ARROW 66
|
|
146 #define CNAME 67
|
|
147 #define SASS 68
|
67
|
148 #define RSTRUCT 69
|
0
|
149
|
81
|
150 #define FASSOP 70
|
|
151 #define DASSOP 71
|
82
|
152 #define DCOMP 72
|
81
|
153 #define DMINUS 73
|
82
|
154 #define DMUL (DOP+MUL)
|
|
155 #define DDIV (DOP+DIV)
|
|
156 #define DADD (DOP+ADD)
|
|
157 #define DSUB (DOP+SUB)
|
78
|
158 #define LMUL 78
|
|
159 #define LDIV 79
|
|
160 #define LADD 80
|
|
161 #define LSUB 81
|
|
162
|
81
|
163 #define FRGVAR 82
|
|
164 #define FRLVAR 83
|
|
165 #define FRINDIRECT 84
|
|
166 #define DRGVAR 85
|
|
167 #define DRLVAR 86
|
|
168 #define DRINDIRECT 87
|
|
169 #define LRGVAR 88
|
|
170 #define LRLVAR 89
|
|
171 #define LRINDIRECT 90
|
|
172 #define DCONST 91
|
85
|
173 #define FCONST 92
|
|
174 #define LCONST 93
|
|
175 #define DASS 94
|
|
176 #define FASS 95
|
|
177 #define LASS 96
|
|
178 #define SHASS 97
|
81
|
179
|
85
|
180 #define I2D 98
|
|
181 #define D2I 99
|
|
182 #define U2D 100
|
|
183 #define D2U 101
|
|
184 #define FPOSTINC 102
|
|
185 #define DPOSTINC 103
|
|
186 #define FPREINC 104
|
|
187 #define DPREINC 105
|
81
|
188
|
0
|
189 #define US 1
|
81
|
190 #define AS 200
|
83
|
191 #define DOP 400
|
0
|
192
|
|
193 #define FILERR 1
|
|
194 #define DCERR 2
|
|
195 #define STERR 3
|
|
196 #define EXERR 4
|
|
197 #define CNERR 5
|
|
198 #define CHERR 6
|
|
199 #define GSERR 7
|
|
200 #define LSERR 8
|
|
201 #define STRERR 9
|
|
202 #define LNERR 10
|
|
203 #define EOFERR 11
|
|
204 #define MCERR 12
|
|
205 #define INCERR 13
|
|
206 #define HPERR 14
|
|
207 #define TYERR 15
|
|
208 #define LVERR 16
|
|
209 #define UDERR 17
|
|
210 #define OPTION 18
|
|
211 #define REG_ERR 19
|
|
212 #define CODE_ERR 20
|
29
|
213 #define MSERR 21
|
0
|
214
|
|
215 #define GSYMS 9000
|
|
216 #define LSYMS 500
|
32
|
217 #define MSYMS 3000
|
0
|
218
|
|
219 #define HEAPSIZE 10000
|
|
220 /* #define CHEAPSIZE 3000 */
|
|
221 #define CHEAPSIZE 256000
|
|
222 #define LBUFSIZE 4096
|
34
|
223 #define MACROSIZE 16000
|
0
|
224
|
25
|
225 #define FILES 10
|
0
|
226 #define OUTPUT_FILE_NAME "mcout.s"
|
|
227
|
29
|
228 EXTERN int sym,ch,type,mode,stmode,gfree,lfree,mflag,lineno,glineno;
|
0
|
229 EXTERN int labelno,gpc,disp,reg_var,debug;
|
|
230 EXTERN int symval,args,init_vars,heap[HEAPSIZE];
|
|
231 EXTERN int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf;
|
|
232 EXTERN int MAX_REGISTER_VAR;
|
81
|
233 EXTERN double dsymval;
|
0
|
234
|
|
235 EXTERN unsigned hash;
|
|
236
|
34
|
237 EXTERN int chsave;
|
|
238 EXTERN char *chptrsave;
|
29
|
239 EXTERN char linebuf[LBUFSIZE],namebuf[LBUFSIZE],*chptr;
|
0
|
240 EXTERN char *name,*cheapp,**av,/*obuf[320],*/*sptr,escape(void);
|
42
|
241 EXTERN int arg_offset,stat_no,size_of_int,disp_offset,endian,csvalue1;
|
0
|
242 EXTERN int code_arg_offset;
|
81
|
243 EXTERN int size_of_double,size_of_float,size_of_longlong;
|
0
|
244 EXTERN int retlabel,retpending,retcont;
|
77
|
245 EXTERN int arglist;
|
0
|
246
|
|
247 EXTERN FILE *obuf;
|
|
248
|
|
249 typedef struct nametable {
|
|
250 char *nm;
|
|
251 int sc,ty,dsp; } NMTBL;
|
|
252
|
30
|
253 EXTERN NMTBL mtable[MSYMS];
|
28
|
254 EXTERN NMTBL ntable[GSYMS+LSYMS];
|
|
255 EXTERN NMTBL *nptr,*gnptr;
|
0
|
256 EXTERN NMTBL *fnptr;
|
72
|
257 EXTERN int typedefed,gtypedefed;
|
0
|
258
|
25
|
259 EXTERN struct {int fd,ln;char *name0;FILE *fcb;} *filep,filestack[FILES];
|
0
|
260 EXTERN char cheap[CHEAPSIZE];
|
34
|
261 EXTERN char *macropp,macro_buf[MACROSIZE];
|
0
|
262
|
61
|
263 extern void error(int n);
|
|
264 extern int size(int t);
|
|
265 extern int scalar(int t);
|
81
|
266 extern int dlist2(int e1, double e2);
|
61
|
267 extern int list2(int e1, int e2);
|
|
268 extern int list3(int e1, int e2, int e3);
|
|
269 extern int list4(int e1, int e2, int e3,int e4);
|
|
270 extern int reverse0(int t1);
|
|
271 extern int assign_data(int e, int t, NMTBL *n,int offset);
|
|
272 extern int assign_expr0(int e1,int e2,int t,int type) ;
|
|
273 extern int assign_expr(int e1,int e2,int t,int type) ;
|
|
274 extern int append4(int p,int a1,int a2,int a3);
|
|
275
|
|
276
|
|
277
|
33
|
278 #define car(e) (heap[(int)(e)])
|
|
279
|
|
280 #define cadr(e) (heap[((int)(e))+1])
|
|
281
|
|
282 #define caddr(e) (heap[((int)(e))+2])
|
|
283
|
|
284 #define cadddr(e) (heap[((int)(e))+3])
|
|
285
|
81
|
286 #define dcadr(e) (*(double*)&heap[((int)(e))+1])
|
|
287 #define dcaddr(e) (*(double*)&heap[((int)(e))+2])
|
|
288
|
66
|
289 #include "conv/conv.h"
|
|
290 /*
|
59
|
291 #include "conv/c2cbc.h"
|
|
292 #include "conv/cbc2c.h"
|
66
|
293 */
|
59
|
294
|
62
|
295 extern Converter *conv;
|
59
|
296
|
61
|
297 EXTERN void error(int n);
|
|
298 EXTERN int append4(int p,int a1,int a2,int a3);
|
|
299 EXTERN int assign_expr(int e1,int e2,int t,int type);
|
|
300 EXTERN int assign_expr0(int e1,int e2,int t,int type);
|
|
301 EXTERN int backdef(void);
|
|
302 EXTERN int fwdlabel(void);
|
|
303 EXTERN int get_register_var(void);
|
|
304 EXTERN int glist2(int e1,int e2);
|
|
305 EXTERN int integral(int t);
|
|
306 EXTERN int list2(int e1, int e2);
|
|
307 EXTERN int list3(int e1, int e2, int e3);
|
|
308 EXTERN int list4(int e1, int e2, int e3, int e4);
|
|
309 EXTERN int reverse0(int t1);
|
|
310 EXTERN int rplacad(int e, int n);
|
|
311 EXTERN int rplacadd(int e, int n);
|
|
312 EXTERN int rvalue_t(int e,int type);
|
|
313 EXTERN int scalar(int t);
|
|
314 EXTERN void bexpr(int e1, char cond, int l1);
|
|
315 EXTERN void def_label(int cslabel, int dlabel);
|
|
316 EXTERN void display_ntable(NMTBL *n, char *s);
|
|
317 EXTERN void exit(int l);
|
|
318 EXTERN void fwddef(int l);
|
|
319
|
33
|
320 /* end */
|