1
|
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 enum TY impcnvResult[TMAX][TMAX];
|
|
16 enum TY impcnvType1[TMAX][TMAX];
|
|
17 enum 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 X(Tbit,Tbit, Tint32,Tint32, Tint32)
|
|
57 X(Tbit,Tint8, Tint32,Tint32, Tint32)
|
|
58 X(Tbit,Tuns8, Tint32,Tint32, Tint32)
|
|
59 X(Tbit,Tint16, Tint32,Tint32, Tint32)
|
|
60 X(Tbit,Tuns16, Tint32,Tint32, Tint32)
|
|
61 X(Tbit,Tint32, Tint32,Tint32, Tint32)
|
|
62 X(Tbit,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
63 X(Tbit,Tint64, Tint64,Tint64, Tint64)
|
|
64 X(Tbit,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
65
|
|
66 X(Tbit,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
67 X(Tbit,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
68 X(Tbit,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
69 X(Tbit,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
70 X(Tbit,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
71 X(Tbit,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
72 X(Tbit,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
73 X(Tbit,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
74 X(Tbit,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
75
|
|
76 /* ======================= */
|
|
77
|
|
78 X(Tbool,Tbool, Tbool,Tbool, Tbool)
|
|
79 X(Tbool,Tint8, Tint32,Tint32, Tint32)
|
|
80 X(Tbool,Tuns8, Tint32,Tint32, Tint32)
|
|
81 X(Tbool,Tint16, Tint32,Tint32, Tint32)
|
|
82 X(Tbool,Tuns16, Tint32,Tint32, Tint32)
|
|
83 X(Tbool,Tint32, Tint32,Tint32, Tint32)
|
|
84 X(Tbool,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
85 X(Tbool,Tint64, Tint64,Tint64, Tint64)
|
|
86 X(Tbool,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
87
|
|
88 X(Tbool,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
89 X(Tbool,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
90 X(Tbool,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
91 X(Tbool,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
92 X(Tbool,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
93 X(Tbool,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
94 X(Tbool,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
95 X(Tbool,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
96 X(Tbool,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
97
|
|
98 /* ======================= */
|
|
99
|
|
100 X(Tint8,Tint8, Tint32,Tint32, Tint32)
|
|
101 X(Tint8,Tuns8, Tint32,Tint32, Tint32)
|
|
102 X(Tint8,Tint16, Tint32,Tint32, Tint32)
|
|
103 X(Tint8,Tuns16, Tint32,Tint32, Tint32)
|
|
104 X(Tint8,Tint32, Tint32,Tint32, Tint32)
|
|
105 X(Tint8,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
106 X(Tint8,Tint64, Tint64,Tint64, Tint64)
|
|
107 X(Tint8,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
108
|
|
109 X(Tint8,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
110 X(Tint8,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
111 X(Tint8,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
112 X(Tint8,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
113 X(Tint8,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
114 X(Tint8,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
115 X(Tint8,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
116 X(Tint8,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
117 X(Tint8,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
118
|
|
119 /* ======================= */
|
|
120
|
|
121 X(Tuns8,Tuns8, Tint32,Tint32, Tint32)
|
|
122 X(Tuns8,Tint16, Tint32,Tint32, Tint32)
|
|
123 X(Tuns8,Tuns16, Tint32,Tint32, Tint32)
|
|
124 X(Tuns8,Tint32, Tint32,Tint32, Tint32)
|
|
125 X(Tuns8,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
126 X(Tuns8,Tint64, Tint64,Tint64, Tint64)
|
|
127 X(Tuns8,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
128
|
|
129 X(Tuns8,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
130 X(Tuns8,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
131 X(Tuns8,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
132 X(Tuns8,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
133 X(Tuns8,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
134 X(Tuns8,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
135 X(Tuns8,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
136 X(Tuns8,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
137 X(Tuns8,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
138
|
|
139 /* ======================= */
|
|
140
|
|
141 X(Tint16,Tint16, Tint32,Tint32, Tint32)
|
|
142 X(Tint16,Tuns16, Tint32,Tint32, Tint32)
|
|
143 X(Tint16,Tint32, Tint32,Tint32, Tint32)
|
|
144 X(Tint16,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
145 X(Tint16,Tint64, Tint64,Tint64, Tint64)
|
|
146 X(Tint16,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
147
|
|
148 X(Tint16,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
149 X(Tint16,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
150 X(Tint16,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
151 X(Tint16,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
152 X(Tint16,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
153 X(Tint16,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
154 X(Tint16,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
155 X(Tint16,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
156 X(Tint16,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
157
|
|
158 /* ======================= */
|
|
159
|
|
160 X(Tuns16,Tuns16, Tint32,Tint32, Tint32)
|
|
161 X(Tuns16,Tint32, Tint32,Tint32, Tint32)
|
|
162 X(Tuns16,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
163 X(Tuns16,Tint64, Tint64,Tint64, Tint64)
|
|
164 X(Tuns16,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
165
|
|
166 X(Tuns16,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
167 X(Tuns16,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
168 X(Tuns16,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
169 X(Tuns16,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
170 X(Tuns16,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
171 X(Tuns16,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
172 X(Tuns16,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
173 X(Tuns16,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
174 X(Tuns16,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
175
|
|
176 /* ======================= */
|
|
177
|
|
178 X(Tint32,Tint32, Tint32,Tint32, Tint32)
|
|
179 X(Tint32,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
180 X(Tint32,Tint64, Tint64,Tint64, Tint64)
|
|
181 X(Tint32,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
182
|
|
183 X(Tint32,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
184 X(Tint32,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
185 X(Tint32,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
186 X(Tint32,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
187 X(Tint32,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
188 X(Tint32,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
189 X(Tint32,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
190 X(Tint32,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
191 X(Tint32,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
192
|
|
193 /* ======================= */
|
|
194
|
|
195 X(Tuns32,Tuns32, Tuns32,Tuns32, Tuns32)
|
|
196 X(Tuns32,Tint64, Tint64,Tint64, Tint64)
|
|
197 X(Tuns32,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
198
|
|
199 X(Tuns32,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
200 X(Tuns32,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
201 X(Tuns32,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
202 X(Tuns32,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
203 X(Tuns32,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
204 X(Tuns32,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
205 X(Tuns32,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
206 X(Tuns32,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
207 X(Tuns32,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
208
|
|
209 /* ======================= */
|
|
210
|
|
211 X(Tint64,Tint64, Tint64,Tint64, Tint64)
|
|
212 X(Tint64,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
213
|
|
214 X(Tint64,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
215 X(Tint64,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
216 X(Tint64,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
217 X(Tint64,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
218 X(Tint64,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
219 X(Tint64,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
220 X(Tint64,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
221 X(Tint64,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
222 X(Tint64,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
223
|
|
224 /* ======================= */
|
|
225
|
|
226 X(Tuns64,Tuns64, Tuns64,Tuns64, Tuns64)
|
|
227
|
|
228 X(Tuns64,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
229 X(Tuns64,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
230 X(Tuns64,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
231 X(Tuns64,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
232 X(Tuns64,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
233 X(Tuns64,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
234 X(Tuns64,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
235 X(Tuns64,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
236 X(Tuns64,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
237
|
|
238 /* ======================= */
|
|
239
|
|
240 X(Tfloat32,Tfloat32, Tfloat32,Tfloat32, Tfloat32)
|
|
241 X(Tfloat32,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
242 X(Tfloat32,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
243
|
|
244 X(Tfloat32,Timaginary32, Tfloat32,Timaginary32, Tfloat32)
|
|
245 X(Tfloat32,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
246 X(Tfloat32,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
247
|
|
248 X(Tfloat32,Tcomplex32, Tfloat32,Tcomplex32, Tcomplex32)
|
|
249 X(Tfloat32,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
250 X(Tfloat32,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
251
|
|
252 /* ======================= */
|
|
253
|
|
254 X(Tfloat64,Tfloat64, Tfloat64,Tfloat64, Tfloat64)
|
|
255 X(Tfloat64,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
256
|
|
257 X(Tfloat64,Timaginary32, Tfloat64,Timaginary64, Tfloat64)
|
|
258 X(Tfloat64,Timaginary64, Tfloat64,Timaginary64, Tfloat64)
|
|
259 X(Tfloat64,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
260
|
|
261 X(Tfloat64,Tcomplex32, Tfloat64,Tcomplex64, Tcomplex64)
|
|
262 X(Tfloat64,Tcomplex64, Tfloat64,Tcomplex64, Tcomplex64)
|
|
263 X(Tfloat64,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
264
|
|
265 /* ======================= */
|
|
266
|
|
267 X(Tfloat80,Tfloat80, Tfloat80,Tfloat80, Tfloat80)
|
|
268
|
|
269 X(Tfloat80,Timaginary32, Tfloat80,Timaginary80, Tfloat80)
|
|
270 X(Tfloat80,Timaginary64, Tfloat80,Timaginary80, Tfloat80)
|
|
271 X(Tfloat80,Timaginary80, Tfloat80,Timaginary80, Tfloat80)
|
|
272
|
|
273 X(Tfloat80,Tcomplex32, Tfloat80,Tcomplex80, Tcomplex80)
|
|
274 X(Tfloat80,Tcomplex64, Tfloat80,Tcomplex80, Tcomplex80)
|
|
275 X(Tfloat80,Tcomplex80, Tfloat80,Tcomplex80, Tcomplex80)
|
|
276
|
|
277 /* ======================= */
|
|
278
|
|
279 X(Timaginary32,Timaginary32, Timaginary32,Timaginary32, Timaginary32)
|
|
280 X(Timaginary32,Timaginary64, Timaginary64,Timaginary64, Timaginary64)
|
|
281 X(Timaginary32,Timaginary80, Timaginary80,Timaginary80, Timaginary80)
|
|
282
|
|
283 X(Timaginary32,Tcomplex32, Timaginary32,Tcomplex32, Tcomplex32)
|
|
284 X(Timaginary32,Tcomplex64, Timaginary64,Tcomplex64, Tcomplex64)
|
|
285 X(Timaginary32,Tcomplex80, Timaginary80,Tcomplex80, Tcomplex80)
|
|
286
|
|
287 /* ======================= */
|
|
288
|
|
289 X(Timaginary64,Timaginary64, Timaginary64,Timaginary64, Timaginary64)
|
|
290 X(Timaginary64,Timaginary80, Timaginary80,Timaginary80, Timaginary80)
|
|
291
|
|
292 X(Timaginary64,Tcomplex32, Timaginary64,Tcomplex64, Tcomplex64)
|
|
293 X(Timaginary64,Tcomplex64, Timaginary64,Tcomplex64, Tcomplex64)
|
|
294 X(Timaginary64,Tcomplex80, Timaginary80,Tcomplex80, Tcomplex80)
|
|
295
|
|
296 /* ======================= */
|
|
297
|
|
298 X(Timaginary80,Timaginary80, Timaginary80,Timaginary80, Timaginary80)
|
|
299
|
|
300 X(Timaginary80,Tcomplex32, Timaginary80,Tcomplex80, Tcomplex80)
|
|
301 X(Timaginary80,Tcomplex64, Timaginary80,Tcomplex80, Tcomplex80)
|
|
302 X(Timaginary80,Tcomplex80, Timaginary80,Tcomplex80, Tcomplex80)
|
|
303
|
|
304 /* ======================= */
|
|
305
|
|
306 X(Tcomplex32,Tcomplex32, Tcomplex32,Tcomplex32, Tcomplex32)
|
|
307 X(Tcomplex32,Tcomplex64, Tcomplex64,Tcomplex64, Tcomplex64)
|
|
308 X(Tcomplex32,Tcomplex80, Tcomplex80,Tcomplex80, Tcomplex80)
|
|
309
|
|
310 /* ======================= */
|
|
311
|
|
312 X(Tcomplex64,Tcomplex64, Tcomplex64,Tcomplex64, Tcomplex64)
|
|
313 X(Tcomplex64,Tcomplex80, Tcomplex80,Tcomplex80, Tcomplex80)
|
|
314
|
|
315 /* ======================= */
|
|
316
|
|
317 X(Tcomplex80,Tcomplex80, Tcomplex80,Tcomplex80, Tcomplex80)
|
|
318
|
|
319 #undef X
|
|
320
|
|
321 #define Y(t1,t2) impcnvWarn[t1][t2] = 1;
|
|
322 Y(Tint8, Tbit)
|
|
323 Y(Tuns8, Tbit)
|
|
324 Y(Tint16, Tbit)
|
|
325 Y(Tuns16, Tbit)
|
|
326 Y(Tint32, Tbit)
|
|
327 Y(Tuns32, Tbit)
|
|
328 Y(Tint64, Tbit)
|
|
329 Y(Tuns64, Tbit)
|
|
330
|
|
331 Y(Tuns8, Tint8)
|
|
332 Y(Tint16, Tint8)
|
|
333 Y(Tuns16, Tint8)
|
|
334 Y(Tint32, Tint8)
|
|
335 Y(Tuns32, Tint8)
|
|
336 Y(Tint64, Tint8)
|
|
337 Y(Tuns64, Tint8)
|
|
338
|
|
339 Y(Tint8, Tuns8)
|
|
340 Y(Tint16, Tuns8)
|
|
341 Y(Tuns16, Tuns8)
|
|
342 Y(Tint32, Tuns8)
|
|
343 Y(Tuns32, Tuns8)
|
|
344 Y(Tint64, Tuns8)
|
|
345 Y(Tuns64, Tuns8)
|
|
346
|
|
347 Y(Tuns16, Tint16)
|
|
348 Y(Tint32, Tint16)
|
|
349 Y(Tuns32, Tint16)
|
|
350 Y(Tint64, Tint16)
|
|
351 Y(Tuns64, Tint16)
|
|
352
|
|
353 Y(Tint16, Tuns16)
|
|
354 Y(Tint32, Tuns16)
|
|
355 Y(Tuns32, Tuns16)
|
|
356 Y(Tint64, Tuns16)
|
|
357 Y(Tuns64, Tuns16)
|
|
358
|
|
359 // Y(Tuns32, Tint32)
|
|
360 Y(Tint64, Tint32)
|
|
361 Y(Tuns64, Tint32)
|
|
362
|
|
363 // Y(Tint32, Tuns32)
|
|
364 Y(Tint64, Tuns32)
|
|
365 Y(Tuns64, Tuns32)
|
|
366
|
|
367 Y(Tint64, Tuns64)
|
|
368 Y(Tuns64, Tint64)
|
|
369
|
|
370 for (i = 0; i < TMAX; i++)
|
|
371 for (j = 0; j < TMAX; j++)
|
|
372 {
|
|
373 if (impcnvResult[i][j] == Terror)
|
|
374 {
|
|
375 impcnvResult[i][j] = impcnvResult[j][i];
|
|
376 impcnvType1[i][j] = impcnvType2[j][i];
|
|
377 impcnvType2[i][j] = impcnvType1[j][i];
|
|
378 }
|
|
379 }
|
|
380 }
|
|
381
|
|
382 int main()
|
|
383 { FILE *fp;
|
|
384 int i;
|
|
385 int j;
|
|
386
|
|
387 init();
|
|
388
|
|
389 fp = fopen("impcnvtab.c","w");
|
|
390
|
|
391 fprintf(fp,"// This file is generated by impcnvgen.c\n");
|
|
392 fprintf(fp,"#include \"mtype.h\"\n");
|
|
393
|
|
394 fprintf(fp,"unsigned char Type::impcnvResult[TMAX][TMAX] =\n{\n");
|
|
395 for (i = 0; i < TMAX; i++)
|
|
396 {
|
|
397 for (j = 0; j < TMAX; j++)
|
|
398 {
|
|
399 fprintf(fp, "%d,",impcnvResult[i][j]);
|
|
400 }
|
|
401 fprintf(fp, "\n");
|
|
402 }
|
|
403 fprintf(fp,"};\n");
|
|
404
|
|
405 fprintf(fp,"unsigned char Type::impcnvType1[TMAX][TMAX] =\n{\n");
|
|
406 for (i = 0; i < TMAX; i++)
|
|
407 {
|
|
408 for (j = 0; j < TMAX; j++)
|
|
409 {
|
|
410 fprintf(fp, "%d,",impcnvType1[i][j]);
|
|
411 }
|
|
412 fprintf(fp, "\n");
|
|
413 }
|
|
414 fprintf(fp,"};\n");
|
|
415
|
|
416 fprintf(fp,"unsigned char Type::impcnvType2[TMAX][TMAX] =\n{\n");
|
|
417 for (i = 0; i < TMAX; i++)
|
|
418 {
|
|
419 for (j = 0; j < TMAX; j++)
|
|
420 {
|
|
421 fprintf(fp, "%d,",impcnvType2[i][j]);
|
|
422 }
|
|
423 fprintf(fp, "\n");
|
|
424 }
|
|
425 fprintf(fp,"};\n");
|
|
426
|
|
427 fprintf(fp,"unsigned char Type::impcnvWarn[TMAX][TMAX] =\n{\n");
|
|
428 for (i = 0; i < TMAX; i++)
|
|
429 {
|
|
430 for (j = 0; j < TMAX; j++)
|
|
431 {
|
|
432 fprintf(fp, "%d,",impcnvWarn[i][j]);
|
|
433 }
|
|
434 fprintf(fp, "\n");
|
|
435 }
|
|
436 fprintf(fp,"};\n");
|
|
437
|
|
438 fclose(fp);
|
|
439 return EXIT_SUCCESS;
|
|
440 }
|