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)
|
0
|
59
|
|
60 #define TOP 0
|
|
61 #define GDECL 1
|
|
62 #define GSDECL 2
|
|
63 #define GUDECL 3
|
|
64 #define ADECL 4
|
|
65 #define LDECL 5
|
|
66 #define LSDECL 6
|
|
67 #define LUDECL 7
|
|
68 #define STADECL 8
|
|
69 #define STAT 9
|
|
70 #define GTDECL 10
|
|
71 #define LTDECL 11
|
18
|
72 #define IFDEF 12
|
29
|
73 #define MDECL 13
|
0
|
74
|
|
75 #define GVAR 1
|
|
76 #define RGVAR 2
|
|
77 #define CRGVAR 3
|
|
78 #define LVAR 4
|
|
79 #define RLVAR 5
|
|
80 #define CRLVAR 6
|
|
81 #define CONST 7
|
|
82 #define FNAME 8
|
|
83 #define INDIRECT 9
|
|
84 #define RINDIRECT 10
|
|
85 #define CRINDIRECT 11
|
|
86 #define ADDRESS 12
|
|
87 #define MINUS 13
|
|
88 #define LNOT 14
|
|
89 #define BNOT 15
|
|
90 #define INC 16
|
|
91 #define POSTINC 17
|
|
92 #define PREINC 18
|
|
93 #define CPOSTINC 19
|
|
94 #define CPREINC 20
|
|
95 #define DEC 21
|
|
96 #define CPOSTDEC 22
|
|
97 #define CPREDEC 23
|
|
98 #define MUL 24
|
|
99 #define UMUL 25
|
|
100 #define DIV 26
|
|
101 #define UDIV 27
|
|
102 #define MOD 28
|
|
103 #define UMOD 29
|
|
104 #define ADD 30
|
|
105 #define SUB 31
|
|
106 #define RSHIFT 32
|
|
107 #define URSHIFT 33
|
|
108 #define LSHIFT 34
|
|
109 #define ULSHIFT 35
|
|
110 #define GT 36
|
|
111 #define UGT 37
|
|
112 #define GE 38
|
|
113 #define UGE 39
|
|
114 #define LT 40
|
|
115 #define ULT 41
|
|
116 #define LE 42
|
|
117 #define ULE 43
|
|
118 #define EQ 44
|
|
119 #define NEQ 45
|
|
120 #define BAND 46
|
|
121 #define EOR 47
|
|
122 #define BOR 48
|
|
123 #define LAND 49
|
|
124 #define LOR 50
|
|
125 #define COND 51
|
|
126 #define ASS 52
|
|
127 #define CASS 53
|
|
128 #define ASSOP 54
|
|
129 #define CASSOP 55
|
|
130 #define COMMA 56
|
|
131 #define LPAR 57
|
|
132 #define RPAR 58
|
|
133 #define LBRA 59
|
|
134 #define RBRA 60
|
|
135 #define LC 61
|
|
136 #define RC 62
|
|
137 #define COLON 63
|
|
138 #define SM 64
|
|
139 #define PERIOD 65
|
|
140 #define ARROW 66
|
|
141 #define CNAME 67
|
|
142 #define SASS 68
|
|
143 #define DOTS 69
|
|
144
|
|
145 #define US 1
|
|
146 #define AS 100
|
|
147
|
|
148 #define FILERR 1
|
|
149 #define DCERR 2
|
|
150 #define STERR 3
|
|
151 #define EXERR 4
|
|
152 #define CNERR 5
|
|
153 #define CHERR 6
|
|
154 #define GSERR 7
|
|
155 #define LSERR 8
|
|
156 #define STRERR 9
|
|
157 #define LNERR 10
|
|
158 #define EOFERR 11
|
|
159 #define MCERR 12
|
|
160 #define INCERR 13
|
|
161 #define HPERR 14
|
|
162 #define TYERR 15
|
|
163 #define LVERR 16
|
|
164 #define UDERR 17
|
|
165 #define OPTION 18
|
|
166 #define REG_ERR 19
|
|
167 #define CODE_ERR 20
|
29
|
168 #define MSERR 21
|
0
|
169
|
|
170 #define GSYMS 9000
|
|
171 #define LSYMS 500
|
32
|
172 #define MSYMS 3000
|
0
|
173
|
|
174 #define HEAPSIZE 10000
|
|
175 /* #define CHEAPSIZE 3000 */
|
|
176 #define CHEAPSIZE 256000
|
|
177 #define LBUFSIZE 4096
|
34
|
178 #define MACROSIZE 16000
|
0
|
179
|
25
|
180 #define FILES 10
|
0
|
181 #define OUTPUT_FILE_NAME "mcout.s"
|
|
182
|
29
|
183 EXTERN int sym,ch,type,mode,stmode,gfree,lfree,mflag,lineno,glineno;
|
0
|
184 EXTERN int labelno,gpc,disp,reg_var,debug;
|
|
185 EXTERN int symval,args,init_vars,heap[HEAPSIZE];
|
|
186 EXTERN int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf;
|
|
187 EXTERN int MAX_REGISTER_VAR;
|
|
188
|
|
189 EXTERN unsigned hash;
|
|
190
|
34
|
191 EXTERN int chsave;
|
|
192 EXTERN char *chptrsave;
|
29
|
193 EXTERN char linebuf[LBUFSIZE],namebuf[LBUFSIZE],*chptr;
|
0
|
194 EXTERN char *name,*cheapp,**av,/*obuf[320],*/*sptr,escape(void);
|
3
|
195 EXTERN int arg_offset,stat_no,size_of_int,disp_offset,endian,csvalue,csvalue1;
|
0
|
196 EXTERN int code_arg_offset;
|
|
197 EXTERN int retlabel,retpending,retcont;
|
|
198
|
|
199 EXTERN FILE *obuf;
|
|
200
|
|
201 typedef struct nametable {
|
|
202 char *nm;
|
|
203 int sc,ty,dsp; } NMTBL;
|
|
204
|
30
|
205 EXTERN NMTBL mtable[MSYMS];
|
28
|
206 EXTERN NMTBL ntable[GSYMS+LSYMS];
|
|
207 EXTERN NMTBL *nptr,*gnptr;
|
|
208 EXTERN NMTBL *decl0(void),*decl1(void),*lsearch(char *name),*gsearch(void);
|
0
|
209 EXTERN NMTBL *fnptr;
|
29
|
210 EXTERN NMTBL *msearch(char *name);
|
30
|
211 EXTERN NMTBL *msearch0(char *name);
|
0
|
212
|
25
|
213 EXTERN struct {int fd,ln;char *name0;FILE *fcb;} *filep,filestack[FILES];
|
0
|
214 EXTERN char cheap[CHEAPSIZE];
|
34
|
215 EXTERN char *macropp,macro_buf[MACROSIZE];
|
0
|
216
|
33
|
217 #define car(e) (heap[(int)(e)])
|
|
218
|
|
219 #define cadr(e) (heap[((int)(e))+1])
|
|
220
|
|
221 #define caddr(e) (heap[((int)(e))+2])
|
|
222
|
|
223 #define cadddr(e) (heap[((int)(e))+3])
|
|
224
|
|
225 /* end */
|