Mercurial > projects > ldc
comparison dmd2/impcnvgen.c @ 758:f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 11 Nov 2008 01:38:48 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
757:2c730d530c98 | 758:f04dde6e882c |
---|---|
1 | |
2 // Copyright (c) 1999-2006 by Digital Mars | |
3 // All Rights Reserved | |
4 // written by Walter Bright | |
5 // http://www.digitalmars.com | |
6 // License for redistribution is by either the Artistic License | |
7 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
8 // See the included readme.txt for details. | |
9 | |
10 #include <stdio.h> | |
11 #include <stdlib.h> | |
12 | |
13 #include "mtype.h" | |
14 | |
15 TY impcnvResult[TMAX][TMAX]; | |
16 TY impcnvType1[TMAX][TMAX]; | |
17 TY impcnvType2[TMAX][TMAX]; | |
18 int impcnvWarn[TMAX][TMAX]; | |
19 | |
20 int integral_promotion(int t) | |
21 { | |
22 switch (t) | |
23 { | |
24 case Tchar: | |
25 case Twchar: | |
26 //case Tbit: | |
27 case Tbool: | |
28 case Tint8: | |
29 case Tuns8: | |
30 case Tint16: | |
31 case Tuns16: return Tint32; | |
32 case Tdchar: return Tuns32; | |
33 default: return t; | |
34 } | |
35 } | |
36 | |
37 void init() | |
38 { int i, j; | |
39 | |
40 // Set conversion tables | |
41 for (i = 0; i < TMAX; i++) | |
42 for (j = 0; j < TMAX; j++) | |
43 { impcnvResult[i][j] = Terror; | |
44 impcnvType1[i][j] = Terror; | |
45 impcnvType2[i][j] = Terror; | |
46 impcnvWarn[i][j] = 0; | |
47 } | |
48 | |
49 #define X(t1,t2, nt1,nt2, rt) \ | |
50 impcnvResult[t1][t2] = rt; \ | |
51 impcnvType1[t1][t2] = nt1; \ | |
52 impcnvType2[t1][t2] = nt2; | |
53 | |
54 /* ======================= */ | |
55 | |
56 #if 0 | |
57 X(Tbit,Tbit, Tint32,Tint32, Tint32) | |
58 X(Tbit,Tint8, Tint32,Tint32, Tint32) | |
59 X(Tbit,Tuns8, Tint32,Tint32, Tint32) | |
60 X(Tbit,Tint16, Tint32,Tint32, Tint32) | |
61 X(Tbit,Tuns16, Tint32,Tint32, Tint32) | |
62 X(Tbit,Tint32, Tint32,Tint32, Tint32) | |
63 X(Tbit,Tuns32, Tuns32,Tuns32, Tuns32) | |
64 X(Tbit,Tint64, Tint64,Tint64, Tint64) | |
65 X(Tbit,Tuns64, Tuns64,Tuns64, Tuns64) | |
66 | |
67 X(Tbit,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
68 X(Tbit,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
69 X(Tbit,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
70 X(Tbit,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
71 X(Tbit,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
72 X(Tbit,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
73 X(Tbit,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
74 X(Tbit,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
75 X(Tbit,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
76 #endif | |
77 | |
78 /* ======================= */ | |
79 | |
80 X(Tbool,Tbool, Tbool,Tbool, Tbool) | |
81 X(Tbool,Tint8, Tint32,Tint32, Tint32) | |
82 X(Tbool,Tuns8, Tint32,Tint32, Tint32) | |
83 X(Tbool,Tint16, Tint32,Tint32, Tint32) | |
84 X(Tbool,Tuns16, Tint32,Tint32, Tint32) | |
85 X(Tbool,Tint32, Tint32,Tint32, Tint32) | |
86 X(Tbool,Tuns32, Tuns32,Tuns32, Tuns32) | |
87 X(Tbool,Tint64, Tint64,Tint64, Tint64) | |
88 X(Tbool,Tuns64, Tuns64,Tuns64, Tuns64) | |
89 | |
90 X(Tbool,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
91 X(Tbool,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
92 X(Tbool,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
93 X(Tbool,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
94 X(Tbool,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
95 X(Tbool,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
96 X(Tbool,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
97 X(Tbool,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
98 X(Tbool,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
99 | |
100 /* ======================= */ | |
101 | |
102 X(Tint8,Tint8, Tint32,Tint32, Tint32) | |
103 X(Tint8,Tuns8, Tint32,Tint32, Tint32) | |
104 X(Tint8,Tint16, Tint32,Tint32, Tint32) | |
105 X(Tint8,Tuns16, Tint32,Tint32, Tint32) | |
106 X(Tint8,Tint32, Tint32,Tint32, Tint32) | |
107 X(Tint8,Tuns32, Tuns32,Tuns32, Tuns32) | |
108 X(Tint8,Tint64, Tint64,Tint64, Tint64) | |
109 X(Tint8,Tuns64, Tuns64,Tuns64, Tuns64) | |
110 | |
111 X(Tint8,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
112 X(Tint8,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
113 X(Tint8,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
114 X(Tint8,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
115 X(Tint8,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
116 X(Tint8,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
117 X(Tint8,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
118 X(Tint8,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
119 X(Tint8,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
120 | |
121 /* ======================= */ | |
122 | |
123 X(Tuns8,Tuns8, Tint32,Tint32, Tint32) | |
124 X(Tuns8,Tint16, Tint32,Tint32, Tint32) | |
125 X(Tuns8,Tuns16, Tint32,Tint32, Tint32) | |
126 X(Tuns8,Tint32, Tint32,Tint32, Tint32) | |
127 X(Tuns8,Tuns32, Tuns32,Tuns32, Tuns32) | |
128 X(Tuns8,Tint64, Tint64,Tint64, Tint64) | |
129 X(Tuns8,Tuns64, Tuns64,Tuns64, Tuns64) | |
130 | |
131 X(Tuns8,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
132 X(Tuns8,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
133 X(Tuns8,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
134 X(Tuns8,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
135 X(Tuns8,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
136 X(Tuns8,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
137 X(Tuns8,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
138 X(Tuns8,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
139 X(Tuns8,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
140 | |
141 /* ======================= */ | |
142 | |
143 X(Tint16,Tint16, Tint32,Tint32, Tint32) | |
144 X(Tint16,Tuns16, Tint32,Tint32, Tint32) | |
145 X(Tint16,Tint32, Tint32,Tint32, Tint32) | |
146 X(Tint16,Tuns32, Tuns32,Tuns32, Tuns32) | |
147 X(Tint16,Tint64, Tint64,Tint64, Tint64) | |
148 X(Tint16,Tuns64, Tuns64,Tuns64, Tuns64) | |
149 | |
150 X(Tint16,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
151 X(Tint16,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
152 X(Tint16,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
153 X(Tint16,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
154 X(Tint16,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
155 X(Tint16,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
156 X(Tint16,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
157 X(Tint16,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
158 X(Tint16,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
159 | |
160 /* ======================= */ | |
161 | |
162 X(Tuns16,Tuns16, Tint32,Tint32, Tint32) | |
163 X(Tuns16,Tint32, Tint32,Tint32, Tint32) | |
164 X(Tuns16,Tuns32, Tuns32,Tuns32, Tuns32) | |
165 X(Tuns16,Tint64, Tint64,Tint64, Tint64) | |
166 X(Tuns16,Tuns64, Tuns64,Tuns64, Tuns64) | |
167 | |
168 X(Tuns16,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
169 X(Tuns16,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
170 X(Tuns16,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
171 X(Tuns16,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
172 X(Tuns16,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
173 X(Tuns16,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
174 X(Tuns16,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
175 X(Tuns16,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
176 X(Tuns16,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
177 | |
178 /* ======================= */ | |
179 | |
180 X(Tint32,Tint32, Tint32,Tint32, Tint32) | |
181 X(Tint32,Tuns32, Tuns32,Tuns32, Tuns32) | |
182 X(Tint32,Tint64, Tint64,Tint64, Tint64) | |
183 X(Tint32,Tuns64, Tuns64,Tuns64, Tuns64) | |
184 | |
185 X(Tint32,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
186 X(Tint32,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
187 X(Tint32,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
188 X(Tint32,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
189 X(Tint32,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
190 X(Tint32,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
191 X(Tint32,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
192 X(Tint32,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
193 X(Tint32,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
194 | |
195 /* ======================= */ | |
196 | |
197 X(Tuns32,Tuns32, Tuns32,Tuns32, Tuns32) | |
198 X(Tuns32,Tint64, Tint64,Tint64, Tint64) | |
199 X(Tuns32,Tuns64, Tuns64,Tuns64, Tuns64) | |
200 | |
201 X(Tuns32,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
202 X(Tuns32,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
203 X(Tuns32,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
204 X(Tuns32,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
205 X(Tuns32,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
206 X(Tuns32,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
207 X(Tuns32,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
208 X(Tuns32,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
209 X(Tuns32,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
210 | |
211 /* ======================= */ | |
212 | |
213 X(Tint64,Tint64, Tint64,Tint64, Tint64) | |
214 X(Tint64,Tuns64, Tuns64,Tuns64, Tuns64) | |
215 | |
216 X(Tint64,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
217 X(Tint64,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
218 X(Tint64,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
219 X(Tint64,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
220 X(Tint64,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
221 X(Tint64,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
222 X(Tint64,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
223 X(Tint64,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
224 X(Tint64,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
225 | |
226 /* ======================= */ | |
227 | |
228 X(Tuns64,Tuns64, Tuns64,Tuns64, Tuns64) | |
229 | |
230 X(Tuns64,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
231 X(Tuns64,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
232 X(Tuns64,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
233 X(Tuns64,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
234 X(Tuns64,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
235 X(Tuns64,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
236 X(Tuns64,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
237 X(Tuns64,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
238 X(Tuns64,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
239 | |
240 /* ======================= */ | |
241 | |
242 X(Tfloat32,Tfloat32, Tfloat32,Tfloat32, Tfloat32) | |
243 X(Tfloat32,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
244 X(Tfloat32,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
245 | |
246 X(Tfloat32,Timaginary32, Tfloat32,Timaginary32, Tfloat32) | |
247 X(Tfloat32,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
248 X(Tfloat32,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
249 | |
250 X(Tfloat32,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32) | |
251 X(Tfloat32,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
252 X(Tfloat32,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
253 | |
254 /* ======================= */ | |
255 | |
256 X(Tfloat64,Tfloat64, Tfloat64,Tfloat64, Tfloat64) | |
257 X(Tfloat64,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
258 | |
259 X(Tfloat64,Timaginary32, Tfloat64,Timaginary64, Tfloat64) | |
260 X(Tfloat64,Timaginary64, Tfloat64,Timaginary64, Tfloat64) | |
261 X(Tfloat64,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
262 | |
263 X(Tfloat64,Tcomplex32, Tfloat64,Tcomplex64, Tcomplex64) | |
264 X(Tfloat64,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64) | |
265 X(Tfloat64,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
266 | |
267 /* ======================= */ | |
268 | |
269 X(Tfloat80,Tfloat80, Tfloat80,Tfloat80, Tfloat80) | |
270 | |
271 X(Tfloat80,Timaginary32, Tfloat80,Timaginary80, Tfloat80) | |
272 X(Tfloat80,Timaginary64, Tfloat80,Timaginary80, Tfloat80) | |
273 X(Tfloat80,Timaginary80, Tfloat80,Timaginary80, Tfloat80) | |
274 | |
275 X(Tfloat80,Tcomplex32, Tfloat80,Tcomplex80, Tcomplex80) | |
276 X(Tfloat80,Tcomplex64, Tfloat80,Tcomplex80, Tcomplex80) | |
277 X(Tfloat80,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80) | |
278 | |
279 /* ======================= */ | |
280 | |
281 X(Timaginary32,Timaginary32, Timaginary32,Timaginary32, Timaginary32) | |
282 X(Timaginary32,Timaginary64, Timaginary64,Timaginary64, Timaginary64) | |
283 X(Timaginary32,Timaginary80, Timaginary80,Timaginary80, Timaginary80) | |
284 | |
285 X(Timaginary32,Tcomplex32, Timaginary32,Tcomplex32, Tcomplex32) | |
286 X(Timaginary32,Tcomplex64, Timaginary64,Tcomplex64, Tcomplex64) | |
287 X(Timaginary32,Tcomplex80, Timaginary80,Tcomplex80, Tcomplex80) | |
288 | |
289 /* ======================= */ | |
290 | |
291 X(Timaginary64,Timaginary64, Timaginary64,Timaginary64, Timaginary64) | |
292 X(Timaginary64,Timaginary80, Timaginary80,Timaginary80, Timaginary80) | |
293 | |
294 X(Timaginary64,Tcomplex32, Timaginary64,Tcomplex64, Tcomplex64) | |
295 X(Timaginary64,Tcomplex64, Timaginary64,Tcomplex64, Tcomplex64) | |
296 X(Timaginary64,Tcomplex80, Timaginary80,Tcomplex80, Tcomplex80) | |
297 | |
298 /* ======================= */ | |
299 | |
300 X(Timaginary80,Timaginary80, Timaginary80,Timaginary80, Timaginary80) | |
301 | |
302 X(Timaginary80,Tcomplex32, Timaginary80,Tcomplex80, Tcomplex80) | |
303 X(Timaginary80,Tcomplex64, Timaginary80,Tcomplex80, Tcomplex80) | |
304 X(Timaginary80,Tcomplex80, Timaginary80,Tcomplex80, Tcomplex80) | |
305 | |
306 /* ======================= */ | |
307 | |
308 X(Tcomplex32,Tcomplex32, Tcomplex32,Tcomplex32, Tcomplex32) | |
309 X(Tcomplex32,Tcomplex64, Tcomplex64,Tcomplex64, Tcomplex64) | |
310 X(Tcomplex32,Tcomplex80, Tcomplex80,Tcomplex80, Tcomplex80) | |
311 | |
312 /* ======================= */ | |
313 | |
314 X(Tcomplex64,Tcomplex64, Tcomplex64,Tcomplex64, Tcomplex64) | |
315 X(Tcomplex64,Tcomplex80, Tcomplex80,Tcomplex80, Tcomplex80) | |
316 | |
317 /* ======================= */ | |
318 | |
319 X(Tcomplex80,Tcomplex80, Tcomplex80,Tcomplex80, Tcomplex80) | |
320 | |
321 #undef X | |
322 | |
323 #define Y(t1,t2) impcnvWarn[t1][t2] = 1; | |
324 | |
325 #if 0 | |
326 Y(Tint8, Tbit) | |
327 Y(Tuns8, Tbit) | |
328 Y(Tint16, Tbit) | |
329 Y(Tuns16, Tbit) | |
330 Y(Tint32, Tbit) | |
331 Y(Tuns32, Tbit) | |
332 Y(Tint64, Tbit) | |
333 Y(Tuns64, Tbit) | |
334 #endif | |
335 | |
336 Y(Tuns8, Tint8) | |
337 Y(Tint16, Tint8) | |
338 Y(Tuns16, Tint8) | |
339 Y(Tint32, Tint8) | |
340 Y(Tuns32, Tint8) | |
341 Y(Tint64, Tint8) | |
342 Y(Tuns64, Tint8) | |
343 | |
344 Y(Tint8, Tuns8) | |
345 Y(Tint16, Tuns8) | |
346 Y(Tuns16, Tuns8) | |
347 Y(Tint32, Tuns8) | |
348 Y(Tuns32, Tuns8) | |
349 Y(Tint64, Tuns8) | |
350 Y(Tuns64, Tuns8) | |
351 | |
352 Y(Tint8, Tchar) | |
353 Y(Tint16, Tchar) | |
354 Y(Tuns16, Tchar) | |
355 Y(Tint32, Tchar) | |
356 Y(Tuns32, Tchar) | |
357 Y(Tint64, Tchar) | |
358 Y(Tuns64, Tchar) | |
359 | |
360 Y(Tuns16, Tint16) | |
361 Y(Tint32, Tint16) | |
362 Y(Tuns32, Tint16) | |
363 Y(Tint64, Tint16) | |
364 Y(Tuns64, Tint16) | |
365 | |
366 Y(Tint16, Tuns16) | |
367 Y(Tint32, Tuns16) | |
368 Y(Tuns32, Tuns16) | |
369 Y(Tint64, Tuns16) | |
370 Y(Tuns64, Tuns16) | |
371 | |
372 Y(Tint16, Twchar) | |
373 Y(Tint32, Twchar) | |
374 Y(Tuns32, Twchar) | |
375 Y(Tint64, Twchar) | |
376 Y(Tuns64, Twchar) | |
377 | |
378 // Y(Tuns32, Tint32) | |
379 Y(Tint64, Tint32) | |
380 Y(Tuns64, Tint32) | |
381 | |
382 // Y(Tint32, Tuns32) | |
383 Y(Tint64, Tuns32) | |
384 Y(Tuns64, Tuns32) | |
385 | |
386 Y(Tint64, Tdchar) | |
387 Y(Tuns64, Tdchar) | |
388 | |
389 Y(Tint64, Tuns64) | |
390 Y(Tuns64, Tint64) | |
391 | |
392 for (i = 0; i < TMAX; i++) | |
393 for (j = 0; j < TMAX; j++) | |
394 { | |
395 if (impcnvResult[i][j] == Terror) | |
396 { | |
397 impcnvResult[i][j] = impcnvResult[j][i]; | |
398 impcnvType1[i][j] = impcnvType2[j][i]; | |
399 impcnvType2[i][j] = impcnvType1[j][i]; | |
400 } | |
401 } | |
402 } | |
403 | |
404 int main() | |
405 { FILE *fp; | |
406 int i; | |
407 int j; | |
408 | |
409 init(); | |
410 | |
411 fp = fopen("impcnvtab.c","w"); | |
412 | |
413 fprintf(fp,"// This file is generated by impcnvgen.c\n"); | |
414 fprintf(fp,"#include \"mtype.h\"\n"); | |
415 | |
416 fprintf(fp,"unsigned char Type::impcnvResult[TMAX][TMAX] =\n{\n"); | |
417 for (i = 0; i < TMAX; i++) | |
418 { | |
419 for (j = 0; j < TMAX; j++) | |
420 { | |
421 fprintf(fp, "%d,",impcnvResult[i][j]); | |
422 } | |
423 fprintf(fp, "\n"); | |
424 } | |
425 fprintf(fp,"};\n"); | |
426 | |
427 fprintf(fp,"unsigned char Type::impcnvType1[TMAX][TMAX] =\n{\n"); | |
428 for (i = 0; i < TMAX; i++) | |
429 { | |
430 for (j = 0; j < TMAX; j++) | |
431 { | |
432 fprintf(fp, "%d,",impcnvType1[i][j]); | |
433 } | |
434 fprintf(fp, "\n"); | |
435 } | |
436 fprintf(fp,"};\n"); | |
437 | |
438 fprintf(fp,"unsigned char Type::impcnvType2[TMAX][TMAX] =\n{\n"); | |
439 for (i = 0; i < TMAX; i++) | |
440 { | |
441 for (j = 0; j < TMAX; j++) | |
442 { | |
443 fprintf(fp, "%d,",impcnvType2[i][j]); | |
444 } | |
445 fprintf(fp, "\n"); | |
446 } | |
447 fprintf(fp,"};\n"); | |
448 | |
449 fprintf(fp,"unsigned char Type::impcnvWarn[TMAX][TMAX] =\n{\n"); | |
450 for (i = 0; i < TMAX; i++) | |
451 { | |
452 for (j = 0; j < TMAX; j++) | |
453 { | |
454 fprintf(fp, "%d,",impcnvWarn[i][j]); | |
455 } | |
456 fprintf(fp, "\n"); | |
457 } | |
458 fprintf(fp,"};\n"); | |
459 | |
460 fclose(fp); | |
461 return EXIT_SUCCESS; | |
462 } |