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