annotate conv/c.c @ 76:fb3fb9e9a462

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