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