annotate mc.h @ 59:eeca07d1b1c2

*** empty log message ***
author kono
date Wed, 19 Feb 2003 21:22:19 +0900
parents a89cf0d6904f
children 8ffb8ca3fe34
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
1 /* Micro-C header file */
d35df41eac69 Initial revision
kono
parents:
diff changeset
2
d35df41eac69 Initial revision
kono
parents:
diff changeset
3 #define DEBUG error(-1)
d35df41eac69 Initial revision
kono
parents:
diff changeset
4
d35df41eac69 Initial revision
kono
parents:
diff changeset
5 /*#include "CCLIB.TXT" */
19
b62230ea38f6 ifdef debug
kono
parents: 18
diff changeset
6 #ifdef __micro_c__
b62230ea38f6 ifdef debug
kono
parents: 18
diff changeset
7 #include "stdio.h"
b62230ea38f6 ifdef debug
kono
parents: 18
diff changeset
8 #else
b62230ea38f6 ifdef debug
kono
parents: 18
diff changeset
9 #include <stdio.h>
b62230ea38f6 ifdef debug
kono
parents: 18
diff changeset
10 #endif
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
11
d35df41eac69 Initial revision
kono
parents:
diff changeset
12 #define SIZE_INT 4
d35df41eac69 Initial revision
kono
parents:
diff changeset
13
d35df41eac69 Initial revision
kono
parents:
diff changeset
14 #define INT (-1)
d35df41eac69 Initial revision
kono
parents:
diff changeset
15 #define CHAR (-2)
d35df41eac69 Initial revision
kono
parents:
diff changeset
16 #define UNSIGNED (-3)
d35df41eac69 Initial revision
kono
parents:
diff changeset
17 #define POINTER (-4)
d35df41eac69 Initial revision
kono
parents:
diff changeset
18 #define ARRAY (-5)
d35df41eac69 Initial revision
kono
parents:
diff changeset
19 #define STRUCT (-6)
d35df41eac69 Initial revision
kono
parents:
diff changeset
20 #define UNION (-7)
d35df41eac69 Initial revision
kono
parents:
diff changeset
21 #define FUNCTION (-8)
d35df41eac69 Initial revision
kono
parents:
diff changeset
22 #define EMPTY (-9)
d35df41eac69 Initial revision
kono
parents:
diff changeset
23
d35df41eac69 Initial revision
kono
parents:
diff changeset
24 #define STATIC (-10)
d35df41eac69 Initial revision
kono
parents:
diff changeset
25 #define GOTO (-11)
d35df41eac69 Initial revision
kono
parents:
diff changeset
26 #define RETURN (-12)
d35df41eac69 Initial revision
kono
parents:
diff changeset
27 #define BREAK (-13)
d35df41eac69 Initial revision
kono
parents:
diff changeset
28 #define CONTINUE (-14)
d35df41eac69 Initial revision
kono
parents:
diff changeset
29 #define IF (-15)
d35df41eac69 Initial revision
kono
parents:
diff changeset
30 #define ELSE (-16)
d35df41eac69 Initial revision
kono
parents:
diff changeset
31 #define FOR (-17)
d35df41eac69 Initial revision
kono
parents:
diff changeset
32 #define DO (-18)
d35df41eac69 Initial revision
kono
parents:
diff changeset
33 #define WHILE (-19)
d35df41eac69 Initial revision
kono
parents:
diff changeset
34 #define SWITCH (-20)
d35df41eac69 Initial revision
kono
parents:
diff changeset
35 #define CASE (-21)
d35df41eac69 Initial revision
kono
parents:
diff changeset
36 #define DEFAULT (-22)
d35df41eac69 Initial revision
kono
parents:
diff changeset
37 #define RESERVE (-23)
d35df41eac69 Initial revision
kono
parents:
diff changeset
38 #define TAG (-24)
d35df41eac69 Initial revision
kono
parents:
diff changeset
39 #define FIELD (-25)
d35df41eac69 Initial revision
kono
parents:
diff changeset
40 #define IDENT (-26)
d35df41eac69 Initial revision
kono
parents:
diff changeset
41 #define STRING (-27)
d35df41eac69 Initial revision
kono
parents:
diff changeset
42 #define MACRO (-28)
d35df41eac69 Initial revision
kono
parents:
diff changeset
43 #define BLABEL (-29)
d35df41eac69 Initial revision
kono
parents:
diff changeset
44 #define FLABEL (-30)
d35df41eac69 Initial revision
kono
parents:
diff changeset
45 #define TYPEDEF (-31)
d35df41eac69 Initial revision
kono
parents:
diff changeset
46 #define SIZEOF (-32)
d35df41eac69 Initial revision
kono
parents:
diff changeset
47 #define TYPE (-33)
d35df41eac69 Initial revision
kono
parents:
diff changeset
48 #define LONG (-34)
d35df41eac69 Initial revision
kono
parents:
diff changeset
49 #define SHORT (-35)
d35df41eac69 Initial revision
kono
parents:
diff changeset
50 #define EXTRN (-36)
d35df41eac69 Initial revision
kono
parents:
diff changeset
51 #define VOID (-37)
d35df41eac69 Initial revision
kono
parents:
diff changeset
52 #define REGISTER (-38)
d35df41eac69 Initial revision
kono
parents:
diff changeset
53 #define CODE (-39)
d35df41eac69 Initial revision
kono
parents:
diff changeset
54 #define ENVIRONMENT (-40)
18
df7fa8cee67b pass -Wall
kono
parents: 3
diff changeset
55 #define DEFINED (-41)
20
8d3db5fc8a97 *** empty log message ***
kono
parents: 19
diff changeset
56 #define KONST (-42)
28
c6994794f084 functional macro (imcomplete)
kono
parents: 25
diff changeset
57 #define FMACRO (-43)
c6994794f084 functional macro (imcomplete)
kono
parents: 25
diff changeset
58 #define LMACRO (-44)
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
59
d35df41eac69 Initial revision
kono
parents:
diff changeset
60 #define TOP 0
d35df41eac69 Initial revision
kono
parents:
diff changeset
61 #define GDECL 1
d35df41eac69 Initial revision
kono
parents:
diff changeset
62 #define GSDECL 2
d35df41eac69 Initial revision
kono
parents:
diff changeset
63 #define GUDECL 3
d35df41eac69 Initial revision
kono
parents:
diff changeset
64 #define ADECL 4
d35df41eac69 Initial revision
kono
parents:
diff changeset
65 #define LDECL 5
d35df41eac69 Initial revision
kono
parents:
diff changeset
66 #define LSDECL 6
d35df41eac69 Initial revision
kono
parents:
diff changeset
67 #define LUDECL 7
d35df41eac69 Initial revision
kono
parents:
diff changeset
68 #define STADECL 8
d35df41eac69 Initial revision
kono
parents:
diff changeset
69 #define STAT 9
d35df41eac69 Initial revision
kono
parents:
diff changeset
70 #define GTDECL 10
d35df41eac69 Initial revision
kono
parents:
diff changeset
71 #define LTDECL 11
18
df7fa8cee67b pass -Wall
kono
parents: 3
diff changeset
72 #define IFDEF 12
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
73 #define MDECL 13
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
74
d35df41eac69 Initial revision
kono
parents:
diff changeset
75 #define GVAR 1
d35df41eac69 Initial revision
kono
parents:
diff changeset
76 #define RGVAR 2
d35df41eac69 Initial revision
kono
parents:
diff changeset
77 #define CRGVAR 3
d35df41eac69 Initial revision
kono
parents:
diff changeset
78 #define LVAR 4
d35df41eac69 Initial revision
kono
parents:
diff changeset
79 #define RLVAR 5
d35df41eac69 Initial revision
kono
parents:
diff changeset
80 #define CRLVAR 6
d35df41eac69 Initial revision
kono
parents:
diff changeset
81 #define CONST 7
d35df41eac69 Initial revision
kono
parents:
diff changeset
82 #define FNAME 8
d35df41eac69 Initial revision
kono
parents:
diff changeset
83 #define INDIRECT 9
d35df41eac69 Initial revision
kono
parents:
diff changeset
84 #define RINDIRECT 10
d35df41eac69 Initial revision
kono
parents:
diff changeset
85 #define CRINDIRECT 11
d35df41eac69 Initial revision
kono
parents:
diff changeset
86 #define ADDRESS 12
d35df41eac69 Initial revision
kono
parents:
diff changeset
87 #define MINUS 13
d35df41eac69 Initial revision
kono
parents:
diff changeset
88 #define LNOT 14
d35df41eac69 Initial revision
kono
parents:
diff changeset
89 #define BNOT 15
d35df41eac69 Initial revision
kono
parents:
diff changeset
90 #define INC 16
d35df41eac69 Initial revision
kono
parents:
diff changeset
91 #define POSTINC 17
d35df41eac69 Initial revision
kono
parents:
diff changeset
92 #define PREINC 18
d35df41eac69 Initial revision
kono
parents:
diff changeset
93 #define CPOSTINC 19
d35df41eac69 Initial revision
kono
parents:
diff changeset
94 #define CPREINC 20
d35df41eac69 Initial revision
kono
parents:
diff changeset
95 #define DEC 21
d35df41eac69 Initial revision
kono
parents:
diff changeset
96 #define CPOSTDEC 22
d35df41eac69 Initial revision
kono
parents:
diff changeset
97 #define CPREDEC 23
d35df41eac69 Initial revision
kono
parents:
diff changeset
98 #define MUL 24
d35df41eac69 Initial revision
kono
parents:
diff changeset
99 #define UMUL 25
d35df41eac69 Initial revision
kono
parents:
diff changeset
100 #define DIV 26
d35df41eac69 Initial revision
kono
parents:
diff changeset
101 #define UDIV 27
d35df41eac69 Initial revision
kono
parents:
diff changeset
102 #define MOD 28
d35df41eac69 Initial revision
kono
parents:
diff changeset
103 #define UMOD 29
d35df41eac69 Initial revision
kono
parents:
diff changeset
104 #define ADD 30
d35df41eac69 Initial revision
kono
parents:
diff changeset
105 #define SUB 31
d35df41eac69 Initial revision
kono
parents:
diff changeset
106 #define RSHIFT 32
d35df41eac69 Initial revision
kono
parents:
diff changeset
107 #define URSHIFT 33
d35df41eac69 Initial revision
kono
parents:
diff changeset
108 #define LSHIFT 34
d35df41eac69 Initial revision
kono
parents:
diff changeset
109 #define ULSHIFT 35
d35df41eac69 Initial revision
kono
parents:
diff changeset
110 #define GT 36
d35df41eac69 Initial revision
kono
parents:
diff changeset
111 #define UGT 37
d35df41eac69 Initial revision
kono
parents:
diff changeset
112 #define GE 38
d35df41eac69 Initial revision
kono
parents:
diff changeset
113 #define UGE 39
d35df41eac69 Initial revision
kono
parents:
diff changeset
114 #define LT 40
d35df41eac69 Initial revision
kono
parents:
diff changeset
115 #define ULT 41
d35df41eac69 Initial revision
kono
parents:
diff changeset
116 #define LE 42
d35df41eac69 Initial revision
kono
parents:
diff changeset
117 #define ULE 43
d35df41eac69 Initial revision
kono
parents:
diff changeset
118 #define EQ 44
d35df41eac69 Initial revision
kono
parents:
diff changeset
119 #define NEQ 45
d35df41eac69 Initial revision
kono
parents:
diff changeset
120 #define BAND 46
d35df41eac69 Initial revision
kono
parents:
diff changeset
121 #define EOR 47
d35df41eac69 Initial revision
kono
parents:
diff changeset
122 #define BOR 48
d35df41eac69 Initial revision
kono
parents:
diff changeset
123 #define LAND 49
d35df41eac69 Initial revision
kono
parents:
diff changeset
124 #define LOR 50
d35df41eac69 Initial revision
kono
parents:
diff changeset
125 #define COND 51
d35df41eac69 Initial revision
kono
parents:
diff changeset
126 #define ASS 52
d35df41eac69 Initial revision
kono
parents:
diff changeset
127 #define CASS 53
d35df41eac69 Initial revision
kono
parents:
diff changeset
128 #define ASSOP 54
d35df41eac69 Initial revision
kono
parents:
diff changeset
129 #define CASSOP 55
d35df41eac69 Initial revision
kono
parents:
diff changeset
130 #define COMMA 56
d35df41eac69 Initial revision
kono
parents:
diff changeset
131 #define LPAR 57
d35df41eac69 Initial revision
kono
parents:
diff changeset
132 #define RPAR 58
d35df41eac69 Initial revision
kono
parents:
diff changeset
133 #define LBRA 59
d35df41eac69 Initial revision
kono
parents:
diff changeset
134 #define RBRA 60
d35df41eac69 Initial revision
kono
parents:
diff changeset
135 #define LC 61
d35df41eac69 Initial revision
kono
parents:
diff changeset
136 #define RC 62
d35df41eac69 Initial revision
kono
parents:
diff changeset
137 #define COLON 63
d35df41eac69 Initial revision
kono
parents:
diff changeset
138 #define SM 64
d35df41eac69 Initial revision
kono
parents:
diff changeset
139 #define PERIOD 65
d35df41eac69 Initial revision
kono
parents:
diff changeset
140 #define ARROW 66
d35df41eac69 Initial revision
kono
parents:
diff changeset
141 #define CNAME 67
d35df41eac69 Initial revision
kono
parents:
diff changeset
142 #define SASS 68
d35df41eac69 Initial revision
kono
parents:
diff changeset
143 #define DOTS 69
37
412ad2e6c2a2 struct copy
kono
parents: 34
diff changeset
144 #define RSTRUCT 70
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
145
d35df41eac69 Initial revision
kono
parents:
diff changeset
146 #define US 1
d35df41eac69 Initial revision
kono
parents:
diff changeset
147 #define AS 100
d35df41eac69 Initial revision
kono
parents:
diff changeset
148
d35df41eac69 Initial revision
kono
parents:
diff changeset
149 #define FILERR 1
d35df41eac69 Initial revision
kono
parents:
diff changeset
150 #define DCERR 2
d35df41eac69 Initial revision
kono
parents:
diff changeset
151 #define STERR 3
d35df41eac69 Initial revision
kono
parents:
diff changeset
152 #define EXERR 4
d35df41eac69 Initial revision
kono
parents:
diff changeset
153 #define CNERR 5
d35df41eac69 Initial revision
kono
parents:
diff changeset
154 #define CHERR 6
d35df41eac69 Initial revision
kono
parents:
diff changeset
155 #define GSERR 7
d35df41eac69 Initial revision
kono
parents:
diff changeset
156 #define LSERR 8
d35df41eac69 Initial revision
kono
parents:
diff changeset
157 #define STRERR 9
d35df41eac69 Initial revision
kono
parents:
diff changeset
158 #define LNERR 10
d35df41eac69 Initial revision
kono
parents:
diff changeset
159 #define EOFERR 11
d35df41eac69 Initial revision
kono
parents:
diff changeset
160 #define MCERR 12
d35df41eac69 Initial revision
kono
parents:
diff changeset
161 #define INCERR 13
d35df41eac69 Initial revision
kono
parents:
diff changeset
162 #define HPERR 14
d35df41eac69 Initial revision
kono
parents:
diff changeset
163 #define TYERR 15
d35df41eac69 Initial revision
kono
parents:
diff changeset
164 #define LVERR 16
d35df41eac69 Initial revision
kono
parents:
diff changeset
165 #define UDERR 17
d35df41eac69 Initial revision
kono
parents:
diff changeset
166 #define OPTION 18
d35df41eac69 Initial revision
kono
parents:
diff changeset
167 #define REG_ERR 19
d35df41eac69 Initial revision
kono
parents:
diff changeset
168 #define CODE_ERR 20
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
169 #define MSERR 21
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
170
d35df41eac69 Initial revision
kono
parents:
diff changeset
171 #define GSYMS 9000
d35df41eac69 Initial revision
kono
parents:
diff changeset
172 #define LSYMS 500
32
b35787d8a442 macro initialization
kono
parents: 30
diff changeset
173 #define MSYMS 3000
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
174
d35df41eac69 Initial revision
kono
parents:
diff changeset
175 #define HEAPSIZE 10000
d35df41eac69 Initial revision
kono
parents:
diff changeset
176 /* #define CHEAPSIZE 3000 */
d35df41eac69 Initial revision
kono
parents:
diff changeset
177 #define CHEAPSIZE 256000
d35df41eac69 Initial revision
kono
parents:
diff changeset
178 #define LBUFSIZE 4096
34
0756caa79167 macro function recursive and copy method
kono
parents: 33
diff changeset
179 #define MACROSIZE 16000
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
180
25
b7a94557bf92 *** empty log message ***
kono
parents: 20
diff changeset
181 #define FILES 10
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
182 #define OUTPUT_FILE_NAME "mcout.s"
d35df41eac69 Initial revision
kono
parents:
diff changeset
183
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
184 EXTERN int sym,ch,type,mode,stmode,gfree,lfree,mflag,lineno,glineno;
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
185 EXTERN int labelno,gpc,disp,reg_var,debug;
d35df41eac69 Initial revision
kono
parents:
diff changeset
186 EXTERN int symval,args,init_vars,heap[HEAPSIZE];
d35df41eac69 Initial revision
kono
parents:
diff changeset
187 EXTERN int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf;
d35df41eac69 Initial revision
kono
parents:
diff changeset
188 EXTERN int MAX_REGISTER_VAR;
d35df41eac69 Initial revision
kono
parents:
diff changeset
189
d35df41eac69 Initial revision
kono
parents:
diff changeset
190 EXTERN unsigned hash;
d35df41eac69 Initial revision
kono
parents:
diff changeset
191
34
0756caa79167 macro function recursive and copy method
kono
parents: 33
diff changeset
192 EXTERN int chsave;
0756caa79167 macro function recursive and copy method
kono
parents: 33
diff changeset
193 EXTERN char *chptrsave;
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
194 EXTERN char linebuf[LBUFSIZE],namebuf[LBUFSIZE],*chptr;
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
195 EXTERN char *name,*cheapp,**av,/*obuf[320],*/*sptr,escape(void);
42
a89cf0d6904f regv assop
kono
parents: 37
diff changeset
196 EXTERN int arg_offset,stat_no,size_of_int,disp_offset,endian,csvalue1;
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
197 EXTERN int code_arg_offset;
d35df41eac69 Initial revision
kono
parents:
diff changeset
198 EXTERN int retlabel,retpending,retcont;
d35df41eac69 Initial revision
kono
parents:
diff changeset
199
d35df41eac69 Initial revision
kono
parents:
diff changeset
200 EXTERN FILE *obuf;
d35df41eac69 Initial revision
kono
parents:
diff changeset
201
d35df41eac69 Initial revision
kono
parents:
diff changeset
202 typedef struct nametable {
d35df41eac69 Initial revision
kono
parents:
diff changeset
203 char *nm;
d35df41eac69 Initial revision
kono
parents:
diff changeset
204 int sc,ty,dsp; } NMTBL;
d35df41eac69 Initial revision
kono
parents:
diff changeset
205
30
20ed2786a276 still macro
kono
parents: 29
diff changeset
206 EXTERN NMTBL mtable[MSYMS];
28
c6994794f084 functional macro (imcomplete)
kono
parents: 25
diff changeset
207 EXTERN NMTBL ntable[GSYMS+LSYMS];
c6994794f084 functional macro (imcomplete)
kono
parents: 25
diff changeset
208 EXTERN NMTBL *nptr,*gnptr;
c6994794f084 functional macro (imcomplete)
kono
parents: 25
diff changeset
209 EXTERN NMTBL *decl0(void),*decl1(void),*lsearch(char *name),*gsearch(void);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
210 EXTERN NMTBL *fnptr;
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
211 EXTERN NMTBL *msearch(char *name);
30
20ed2786a276 still macro
kono
parents: 29
diff changeset
212 EXTERN NMTBL *msearch0(char *name);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
213
25
b7a94557bf92 *** empty log message ***
kono
parents: 20
diff changeset
214 EXTERN struct {int fd,ln;char *name0;FILE *fcb;} *filep,filestack[FILES];
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
215 EXTERN char cheap[CHEAPSIZE];
34
0756caa79167 macro function recursive and copy method
kono
parents: 33
diff changeset
216 EXTERN char *macropp,macro_buf[MACROSIZE];
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
217
33
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
218 #define car(e) (heap[(int)(e)])
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
219
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
220 #define cadr(e) (heap[((int)(e))+1])
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
221
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
222 #define caddr(e) (heap[((int)(e))+2])
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
223
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
224 #define cadddr(e) (heap[((int)(e))+3])
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
225
59
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
226 typedef struct converter {
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
227 void (*print)(char *);
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
228 } Converter;
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
229
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
230 #include "conv/c2cbc.h"
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
231 #include "conv/cbc2c.h"
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
232 #include "conv/c.h"
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
233 #include "conv/null.h"
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
234
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
235 EXTERN Converter *conv;
eeca07d1b1c2 *** empty log message ***
kono
parents: 42
diff changeset
236
33
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
237 /* end */