annotate conv/c.c @ 564:25f431685d80

*** empty log message ***
author kono
date Tue, 10 Jan 2006 16:30:43 +0900
parents 464e7480395c
children 756ba7c78e4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
aa779bcffef7 CwC converters
kono
parents:
diff changeset
1 #define EXTERN /**/
aa779bcffef7 CwC converters
kono
parents:
diff changeset
2
327
da2e3f2d127d macro/codegen reorganization
kono
parents: 82
diff changeset
3 #include <stdio.h>
60
aa779bcffef7 CwC converters
kono
parents:
diff changeset
4 #include "mc.h"
327
da2e3f2d127d macro/codegen reorganization
kono
parents: 82
diff changeset
5 #include "mc-parse.h"
60
aa779bcffef7 CwC converters
kono
parents:
diff changeset
6
327
da2e3f2d127d macro/codegen reorganization
kono
parents: 82
diff changeset
7 #include "conv/conv.h"
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
8 #include "conv/convdef.h"
82
25654dc29ecc First Floating Point coding done.
kono
parents: 79
diff changeset
9 #include "conv/c.h"
60
aa779bcffef7 CwC converters
kono
parents:
diff changeset
10
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
11 extern void type_print(int type,NMTBL *nptr,FILE *out);
74
6de658ae384c *** empty log message ***
kono
parents: 72
diff changeset
12 extern void type_print1(int type,NMTBL *nptr,FILE *out,int cont);
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
13 extern void sym_print(int type,FILE *out);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
14
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
15 static FILE *vout,*svout;
dba8d111b7a0 c output
kono
parents: 68
diff changeset
16 static FILE *null;
60
aa779bcffef7 CwC converters
kono
parents:
diff changeset
17
aa779bcffef7 CwC converters
kono
parents:
diff changeset
18 static void
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
19 comment_(int c)
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
20 {
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
21 fprintf(vout,"%c",c);
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
22 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
23
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
24 static void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
25 open_(char *s)
65
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
26 {
346
969089695850 name reconfigure.... continue...
kono
parents: 327
diff changeset
27 char *p;
564
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
28 p = make_filename_with_extension(s,"cc");
77
2b8ba655e572 fix arg type
kono
parents: 76
diff changeset
29 #if 1
65
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
30 vout = fopen(p,"w");
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
31 #else
dba8d111b7a0 c output
kono
parents: 68
diff changeset
32 vout = stderr;p=p;
dba8d111b7a0 c output
kono
parents: 68
diff changeset
33 #endif
dba8d111b7a0 c output
kono
parents: 68
diff changeset
34 null=fopen("/dev/null","w");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
35 if (!vout) error(-1);
65
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
36 }
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
37
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
38 static void
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
39 conv_()
dba8d111b7a0 c output
kono
parents: 68
diff changeset
40 {
dba8d111b7a0 c output
kono
parents: 68
diff changeset
41 vout=svout;
dba8d111b7a0 c output
kono
parents: 68
diff changeset
42 }
dba8d111b7a0 c output
kono
parents: 68
diff changeset
43
dba8d111b7a0 c output
kono
parents: 68
diff changeset
44 static void
dba8d111b7a0 c output
kono
parents: 68
diff changeset
45 noconv_(int c)
dba8d111b7a0 c output
kono
parents: 68
diff changeset
46 {
dba8d111b7a0 c output
kono
parents: 68
diff changeset
47 svout=vout;
dba8d111b7a0 c output
kono
parents: 68
diff changeset
48 vout=c?null:vout;
dba8d111b7a0 c output
kono
parents: 68
diff changeset
49 }
dba8d111b7a0 c output
kono
parents: 68
diff changeset
50
dba8d111b7a0 c output
kono
parents: 68
diff changeset
51 static void
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
52 print_(char *s)
60
aa779bcffef7 CwC converters
kono
parents:
diff changeset
53 {
aa779bcffef7 CwC converters
kono
parents:
diff changeset
54 fprintf(vout,"c: %s\n",s);
aa779bcffef7 CwC converters
kono
parents:
diff changeset
55 }
65
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
56
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
57 static void
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
58 close_()
65
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
59 {
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
60 fclose(vout);
8ad746efa4f8 *** empty log message ***
kono
parents: 60
diff changeset
61 }
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
62
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
63 void
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
64 case_begin_(int cases,int def){
254a0c576114 argument type list
kono
parents: 66
diff changeset
65 fprintf(vout,"case ");
254a0c576114 argument type list
kono
parents: 66
diff changeset
66 }
254a0c576114 argument type list
kono
parents: 66
diff changeset
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
68 void
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
69 case_(int cases,int def){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
70 if (def)
254a0c576114 argument type list
kono
parents: 66
diff changeset
71 fprintf(vout,"default:");
254a0c576114 argument type list
kono
parents: 66
diff changeset
72 else
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
73 fprintf(vout,"%d:",car(cases));
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
74 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
75
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
76 void
79
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
77 code_(NMTBL *n){
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
78 int args;
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
79 args=n->dsp;
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
80 fprintf(vout,"code %s(",n->nm);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
81 while(args) {
79
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
82 n=(NMTBL *)caddr(args);
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
83 type_print(n->ty,n,vout);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
84 args=cadr(args);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
85 if(args) fprintf(vout,",");
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
86 }
76
fb3fb9e9a462 *** empty log message ***
kono
parents: 75
diff changeset
87 fprintf(vout,")\n{");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
88 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
89
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
90 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
91 code_end_(){
76
fb3fb9e9a462 *** empty log message ***
kono
parents: 75
diff changeset
92 fprintf(vout,"}");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
93 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
94
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
95 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
96 comma_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
97 fprintf(vout,",");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
98 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
99
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
100 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
101 cond_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
102
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
103 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
104
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
105 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
106 cond1_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
107 fprintf(vout,"?");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
108 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
109
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
110 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
111 cond2_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
112 fprintf(vout,":");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
113 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
114
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
115 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
116 cond_end_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
117
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
118 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
119
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
120 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
121 decl_data_begin_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
122
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
123 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
124
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
125 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
126 decl_data_end_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
127
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
128 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
129
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
130 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
131 def_(NMTBL *n){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
132 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
133
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
134 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
135 dowhile_(){
72
3b5d293cea36 type def etc
kono
parents: 71
diff changeset
136 fprintf(vout,"do");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
137 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
138
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
139 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
140 dowhile_cond_(){
72
3b5d293cea36 type def etc
kono
parents: 71
diff changeset
141 fprintf(vout,"while(");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
142 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
143
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
144 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
145 dowhile_end_(){
72
3b5d293cea36 type def etc
kono
parents: 71
diff changeset
146 fprintf(vout,");");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
147 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
148
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
149 int
468
464e7480395c *** empty log message ***
kono
parents: 348
diff changeset
150 error_(int n){
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
151 return 0;
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
152 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
153
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
154 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
155 extern_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
156 fprintf(vout,"extern ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
157 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
158
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
159 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
160 for_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
161 fprintf(vout,"for(");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
162 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
163
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
164 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
165 for1_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
166 fprintf(vout,";");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
167 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
168
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
169 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
170 for2_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
171 fprintf(vout,";");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
172 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
173
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
174 void
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
175 for_body_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
176 fprintf(vout,")");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
177 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
178
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
179 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
180 for_end_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
181
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
182 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
183
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
184 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
185 funcall_(int type){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
186 fprintf(vout,"(");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
187 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
188
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
189 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
190 funcall_args_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
191 fprintf(vout,")");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
192 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
193
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
194 void
79
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
195 function_(NMTBL *n,int cont){
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
196 int args;
564
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
197 type_print1(cadr(n->ty),0,vout,cont);
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
198 fprintf(vout,"%s(",n->nm);
79
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
199 args=n->dsp;
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
200 while(args) {
79
82d0e30f61dd *** empty log message ***
kono
parents: 77
diff changeset
201 n=(NMTBL *)caddr(args);
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
202 type_print(n->ty,n,vout);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
203 args=cadr(args);
76
fb3fb9e9a462 *** empty log message ***
kono
parents: 75
diff changeset
204 if(args) {
327
da2e3f2d127d macro/codegen reorganization
kono
parents: 82
diff changeset
205 /* if(caddr(args)==(int)&str_ret) break; */
76
fb3fb9e9a462 *** empty log message ***
kono
parents: 75
diff changeset
206 fprintf(vout,",");
fb3fb9e9a462 *** empty log message ***
kono
parents: 75
diff changeset
207 }
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
208 }
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
209 fprintf(vout,")");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
210 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
211
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
212 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
213 function_end_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
214
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
215 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
216
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
217 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
218 goto_(){
76
fb3fb9e9a462 *** empty log message ***
kono
parents: 75
diff changeset
219 fprintf(vout,"goto ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
220 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
221
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
222 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
223 goto_label_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
224
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
225 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
226
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
227 void
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
228 id_(int sym,NMTBL *nptr){
564
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
229 char *p = nptr->nm;
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
230 for(;*p && *p!='.';p++) fputc(*p,vout);
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
231 }
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
232
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
233 void
348
e77b3a7002ad name table reconfigure compiled. debug start.
kono
parents: 346
diff changeset
234 string_(char *s,int len){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
235 int c;
dba8d111b7a0 c output
kono
parents: 68
diff changeset
236 fprintf(vout,"\"");
dba8d111b7a0 c output
kono
parents: 68
diff changeset
237 while((c=*s++)) {
dba8d111b7a0 c output
kono
parents: 68
diff changeset
238 if(c=='\n') fprintf(vout,"\\n");
dba8d111b7a0 c output
kono
parents: 68
diff changeset
239 else if(c=='\r') fprintf(vout,"\\r");
564
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
240 else if(c=='\t') fprintf(vout,"\\t");
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
241 else if(c=='\e') fprintf(vout,"\\e");
564
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
242 else if(c=='"') fprintf(vout,"\\\"");
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
243 else if(c=='\\') fprintf(vout,"\\\\");
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
244 else if(!(' '<=c&&c<=0x7f)) fprintf(vout,"\\%03o",c);
dba8d111b7a0 c output
kono
parents: 68
diff changeset
245 else fprintf(vout,"%c",c);
dba8d111b7a0 c output
kono
parents: 68
diff changeset
246 }
dba8d111b7a0 c output
kono
parents: 68
diff changeset
247 fprintf(vout,"\"");
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
248 }
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
249
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
250 void
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
251 const_(int symval){
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
252 fprintf(vout,"%d",symval);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
253 }
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
254
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
255 void
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
256 return_f_(){
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
257 fprintf(vout,"return");
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
258 }
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
259
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
260 void
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
261 defined_(char *s){
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
262 fprintf(vout,"defined(%s)",s);
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
263 }
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
264
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
265 void
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
266 environment_(){
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
267 fprintf(vout,"environment");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
268 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
269
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
270 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
271 if_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
272 fprintf(vout,"if (");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
273 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
274
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
275 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
276 if_else_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
277 fprintf(vout," else ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
278 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
279
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
280 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
281 if_endif_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
282 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
283
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
284 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
285 if_then_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
286 fprintf(vout,")");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
287 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
288
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
289 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
290 jump_(int env){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
291
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
292 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
293
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
294 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
295 label_(){
72
3b5d293cea36 type def etc
kono
parents: 71
diff changeset
296 fprintf(vout,"%s:",nptr->nm);
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
297 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
298
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
299 void
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
300 lpar_(){
254a0c576114 argument type list
kono
parents: 66
diff changeset
301 fprintf(vout,"(");
254a0c576114 argument type list
kono
parents: 66
diff changeset
302 }
254a0c576114 argument type list
kono
parents: 66
diff changeset
303
254a0c576114 argument type list
kono
parents: 66
diff changeset
304 void
254a0c576114 argument type list
kono
parents: 66
diff changeset
305 rpar_(){
254a0c576114 argument type list
kono
parents: 66
diff changeset
306 fprintf(vout,")");
254a0c576114 argument type list
kono
parents: 66
diff changeset
307 }
254a0c576114 argument type list
kono
parents: 66
diff changeset
308
254a0c576114 argument type list
kono
parents: 66
diff changeset
309 void
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
310 lbra_(int sym){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
311 fprintf(vout,"[");
254a0c576114 argument type list
kono
parents: 66
diff changeset
312 }
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
313
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
314 void
254a0c576114 argument type list
kono
parents: 66
diff changeset
315 rbra_(int sym){
254a0c576114 argument type list
kono
parents: 66
diff changeset
316 fprintf(vout,"]");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
317 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
318
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
319 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
320 lc_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
321 fprintf(vout,"{");
254a0c576114 argument type list
kono
parents: 66
diff changeset
322 }
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
323
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
324 void
254a0c576114 argument type list
kono
parents: 66
diff changeset
325 rc_(){
254a0c576114 argument type list
kono
parents: 66
diff changeset
326 fprintf(vout,"}");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
327 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
328
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
329 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
330 localvar_end_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
331
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
332 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
333
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
334 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
335 op_(int sym){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
336 sym_print(sym,vout);
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
337 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
338
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
339 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
340 postfix_(int sym){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
341 sym_print(sym,vout);
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
342 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
343
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
344 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
345 prefix_(int sym){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
346 sym_print(sym,vout);
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
347 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
348
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
349 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
350 register_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
351 fprintf(vout,"register ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
352 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
353
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
354 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
355 return_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
356 fprintf(vout,"return ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
357 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
358
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
359 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
360 return_end_(){
70
2e84590720a6 typedef name
kono
parents: 69
diff changeset
361 fprintf(vout,";");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
362 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
363
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
364 void
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
365 return_type_(int t,NMTBL *nptr,int cont){
74
6de658ae384c *** empty log message ***
kono
parents: 72
diff changeset
366 type_print1(t,nptr,vout,cont);
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
367 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
368
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
369 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
370 sm_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
371 fprintf(vout,";");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
372 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
373
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
374 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
375 static_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
376 fprintf(vout,"static ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
377 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
378
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
379 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
380 switch_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
381 fprintf(vout,"switch (");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
382 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
383
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
384 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
385 switch_body_(){
71
be313430f90b *** empty log message ***
kono
parents: 70
diff changeset
386 fprintf(vout,")");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
387 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
388
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
389 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
390 switch_end_(){
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
391 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
392
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
393 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
394 typedef_(){
67
254a0c576114 argument type list
kono
parents: 66
diff changeset
395 fprintf(vout,"typedef ");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
396 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
397
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
398 void
564
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
399 type_(int t){
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
400 type_print(t,0,vout);
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
401 }
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
402
25f431685d80 *** empty log message ***
kono
parents: 468
diff changeset
403 void
70
2e84590720a6 typedef name
kono
parents: 69
diff changeset
404 sdecl_(int s)
2e84590720a6 typedef name
kono
parents: 69
diff changeset
405 {
2e84590720a6 typedef name
kono
parents: 69
diff changeset
406 fprintf(vout,s==UNION?"union ":"struct ");
2e84590720a6 typedef name
kono
parents: 69
diff changeset
407 }
2e84590720a6 typedef name
kono
parents: 69
diff changeset
408
2e84590720a6 typedef name
kono
parents: 69
diff changeset
409 void
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
410 while_(){
68
0266905063b5 *** empty log message ***
kono
parents: 67
diff changeset
411 fprintf(vout,"while (");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
412 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
413
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
414 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
415 while_body_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
416 fprintf(vout,")");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
417 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
418
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
419 void
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
420 while_end_(){
69
dba8d111b7a0 c output
kono
parents: 68
diff changeset
421 }
dba8d111b7a0 c output
kono
parents: 68
diff changeset
422
dba8d111b7a0 c output
kono
parents: 68
diff changeset
423 void
dba8d111b7a0 c output
kono
parents: 68
diff changeset
424 decl_data_()
dba8d111b7a0 c output
kono
parents: 68
diff changeset
425 {
dba8d111b7a0 c output
kono
parents: 68
diff changeset
426 }
dba8d111b7a0 c output
kono
parents: 68
diff changeset
427
dba8d111b7a0 c output
kono
parents: 68
diff changeset
428 void
dba8d111b7a0 c output
kono
parents: 68
diff changeset
429 break_()
dba8d111b7a0 c output
kono
parents: 68
diff changeset
430 {
dba8d111b7a0 c output
kono
parents: 68
diff changeset
431 fprintf(vout,"break;");
dba8d111b7a0 c output
kono
parents: 68
diff changeset
432 }
dba8d111b7a0 c output
kono
parents: 68
diff changeset
433
dba8d111b7a0 c output
kono
parents: 68
diff changeset
434 void
dba8d111b7a0 c output
kono
parents: 68
diff changeset
435 continue_()
dba8d111b7a0 c output
kono
parents: 68
diff changeset
436 {
dba8d111b7a0 c output
kono
parents: 68
diff changeset
437 fprintf(vout,"continue;");
66
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
438 }
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
439
0b068058dd67 *** empty log message ***
kono
parents: 65
diff changeset
440 /* end */