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