60
|
1 #define EXTERN /**/
|
|
2
|
|
3 #include "mc.h"
|
|
4
|
66
|
5 #include "conv/convdef.h"
|
60
|
6
|
|
7 static FILE *vout;
|
|
8
|
|
9 static void
|
67
|
10 comment_(int c)
|
66
|
11 {
|
67
|
12 fprintf(vout,"%c",c);
|
66
|
13 }
|
|
14
|
|
15 static void
|
|
16 open_(char *s)
|
65
|
17 {
|
|
18 char *p=cheapp;
|
66
|
19 while ((*cheapp++ = *s++)) {
|
65
|
20 if (*s=='.') {
|
|
21 *cheapp++=*s++; *cheapp++='c';
|
|
22 *cheapp++='c'; *cheapp++=0;
|
|
23 break;
|
|
24 }
|
|
25 }
|
|
26 vout = fopen(p,"w");
|
66
|
27 if (!vout) error(-1);
|
65
|
28 }
|
|
29
|
|
30 static void
|
66
|
31 print_(char *s)
|
60
|
32 {
|
|
33 fprintf(vout,"c: %s\n",s);
|
|
34 }
|
65
|
35
|
|
36 static void
|
66
|
37 close_()
|
65
|
38 {
|
|
39 fclose(vout);
|
|
40 }
|
66
|
41
|
|
42 void
|
67
|
43 case_begin_(int cases,int def){
|
|
44 fprintf(vout,"case ");
|
|
45 }
|
|
46
|
|
47 void
|
66
|
48 case_(int cases,int def){
|
67
|
49 if (def)
|
|
50 fprintf(vout,"default:");
|
|
51 else
|
|
52 fprintf(vout,":");
|
66
|
53 }
|
|
54
|
|
55 void
|
|
56 code_(NMTBL *fnptr,int arglist){
|
|
57
|
|
58 }
|
|
59
|
|
60 void
|
|
61 code_end_(){
|
|
62
|
|
63 }
|
|
64
|
|
65 void
|
|
66 comma_(){
|
67
|
67 fprintf(vout,",");
|
66
|
68 }
|
|
69
|
|
70 void
|
|
71 cond_(){
|
|
72
|
|
73 }
|
|
74
|
|
75 void
|
|
76 cond1_(){
|
|
77
|
|
78 }
|
|
79
|
|
80 void
|
|
81 cond2_(){
|
|
82
|
|
83 }
|
|
84
|
|
85 void
|
|
86 cond_end_(){
|
|
87
|
|
88 }
|
|
89
|
|
90 void
|
|
91 decl_data_begin_(){
|
|
92
|
|
93 }
|
|
94
|
|
95 void
|
|
96 decl_data_end_(){
|
|
97
|
|
98 }
|
|
99
|
|
100 void
|
|
101 def_(NMTBL *n){
|
|
102 }
|
|
103
|
|
104 void
|
|
105 dowhile_(){
|
|
106
|
|
107 }
|
|
108
|
|
109 void
|
|
110 dowhile_cond_(){
|
|
111
|
|
112 }
|
|
113
|
|
114 void
|
|
115 dowhile_end_(){
|
|
116
|
|
117 }
|
|
118
|
|
119 int
|
|
120 error_(n){
|
|
121 return 0;
|
|
122 }
|
|
123
|
|
124 void
|
|
125 extern_(){
|
67
|
126 fprintf(vout,"extern ");
|
66
|
127 }
|
|
128
|
|
129 void
|
|
130 for_(){
|
|
131
|
|
132 }
|
|
133
|
|
134 void
|
|
135 for1_(){
|
|
136
|
|
137 }
|
|
138
|
|
139 void
|
|
140 for2_(){
|
|
141
|
|
142 }
|
|
143
|
|
144 void
|
|
145 for3_(){
|
|
146
|
|
147 }
|
|
148
|
|
149 void
|
|
150 for_body_(){
|
|
151
|
|
152 }
|
|
153
|
|
154 void
|
|
155 for_end_(){
|
|
156
|
|
157 }
|
|
158
|
|
159 void
|
|
160 funcall_(int type){
|
|
161
|
|
162 }
|
|
163
|
|
164 void
|
|
165 funcall_args_(){
|
|
166
|
|
167 }
|
|
168
|
|
169 void
|
|
170 function_(){
|
|
171
|
|
172 }
|
|
173
|
|
174 void
|
|
175 function_end_(){
|
|
176
|
|
177 }
|
|
178
|
|
179 void
|
|
180 goto_(){
|
|
181
|
|
182 }
|
|
183
|
|
184 void
|
|
185 goto_label_(){
|
|
186
|
|
187 }
|
|
188
|
|
189 void
|
|
190 id_(int sy,NMTBL *nptr){
|
|
191
|
|
192 }
|
|
193
|
|
194 void
|
|
195 if_(){
|
|
196
|
|
197 }
|
|
198
|
|
199 void
|
|
200 if_else_(){
|
|
201
|
|
202 }
|
|
203
|
|
204 void
|
|
205 if_endif_(){
|
|
206
|
|
207 }
|
|
208
|
|
209 void
|
|
210 if_then_(){
|
|
211
|
|
212 }
|
|
213
|
|
214 void
|
|
215 jump_(int env){
|
|
216
|
|
217 }
|
|
218
|
|
219 void
|
|
220 label_(){
|
|
221
|
|
222 }
|
|
223
|
|
224 void
|
67
|
225 lpar_(){
|
|
226 fprintf(vout,"(");
|
|
227 }
|
|
228
|
|
229 void
|
|
230 rpar_(){
|
|
231 fprintf(vout,")");
|
|
232 }
|
|
233
|
|
234 void
|
66
|
235 lbra_(int sym){
|
67
|
236 fprintf(vout,"[");
|
|
237 }
|
66
|
238
|
67
|
239 void
|
|
240 rbra_(int sym){
|
|
241 fprintf(vout,"]");
|
66
|
242 }
|
|
243
|
|
244 void
|
|
245 lc_(){
|
67
|
246 fprintf(vout,"{");
|
|
247 }
|
66
|
248
|
67
|
249 void
|
|
250 rc_(){
|
|
251 fprintf(vout,"}");
|
66
|
252 }
|
|
253
|
|
254 void
|
|
255 localvar_end_(){
|
|
256
|
|
257 }
|
|
258
|
|
259 void
|
|
260 op_(int sym){
|
|
261
|
|
262 }
|
|
263
|
|
264 void
|
|
265 postfix_(int sym){
|
|
266
|
|
267 }
|
|
268
|
|
269 void
|
|
270 prefix_(int sym){
|
|
271
|
|
272 }
|
|
273
|
|
274 void
|
|
275 register_(){
|
67
|
276 fprintf(vout,"register ");
|
66
|
277 }
|
|
278
|
|
279 void
|
|
280 return_(){
|
|
281
|
|
282 }
|
|
283
|
|
284 void
|
|
285 return_end_(){
|
|
286
|
|
287 }
|
|
288
|
67
|
289 extern void type_print(int type,NMTBL *nptr,FILE *out);
|
66
|
290
|
|
291 void
|
67
|
292 return_type_(int t,NMTBL *nptr,int cont){
|
|
293 if (cont) {
|
|
294 if(nptr) fprintf(vout,"%s",nptr->nm);
|
|
295 while (t>0&&car(t)==ARRAY) {
|
|
296 if(caddr(t)==0)
|
|
297 fprintf(vout,"[]");
|
|
298 else
|
|
299 fprintf(vout,"[%d]",caddr(t));
|
|
300 t=cadr(t);
|
|
301 }
|
|
302 } else
|
|
303 type_print(t,nptr,vout);
|
66
|
304 }
|
|
305
|
|
306 void
|
|
307 sm_(){
|
67
|
308 fprintf(vout,";");
|
66
|
309 }
|
|
310
|
|
311 void
|
|
312 static_(){
|
67
|
313 fprintf(vout,"static ");
|
66
|
314 }
|
|
315
|
|
316 void
|
|
317 switch_(){
|
|
318
|
|
319 }
|
|
320
|
|
321 void
|
|
322 switch_body_(){
|
|
323
|
|
324 }
|
|
325
|
|
326 void
|
|
327 switch_end_(){
|
|
328
|
|
329 }
|
|
330
|
|
331 void
|
|
332 typedef_(){
|
67
|
333 fprintf(vout,"typedef ");
|
66
|
334 }
|
|
335
|
|
336 void
|
|
337 while_(){
|
|
338
|
|
339 }
|
|
340
|
|
341 void
|
|
342 while_body_(){
|
|
343
|
|
344 }
|
|
345
|
|
346 void
|
|
347 while_end_(){
|
|
348
|
|
349 }
|
|
350
|
|
351 /* end */
|