CPP builtins
[m6w6/ext-psi] / scripts / gen_calc_cast.php
1 <?php
2 include __DIR__."/_include.php";
3 ?>
4
5
6 static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_type, impl_val *out_val)
7 {
8 switch (out_type) {<?php /*nobr*/ ?>
9 <?php foreach ($types as $t => $v) : ?>
10 <?php if (t_is_special($t)) : ?>
11
12 #if HAVE_<?=$t?>
13 <?php endif; ?>
14
15 case PSI_T_<?=$t?>:
16 switch (in_type) {<?php /*nobr*/ ?>
17 <?php foreach ($types as $t_in => $v_in) : ?>
18 <?php if (t_is_special($t_in)) :?>
19
20 # if HAVE_<?=$t_in?>
21 <?php endif; ?>
22
23 case PSI_T_<?=$t_in?>:
24 out_val-><?=$v?> = in_val-><?=$v_in?>;
25 break;<?php /*nobr*/ ?>
26 <?php if (t_is_special($t_in)) : ?>
27
28 # endif
29 <?php endif; ?>
30 <?php endforeach; ?>
31
32 default:
33 assert(0);
34 break;
35 }
36 break;<?php /*nobr*/ ?>
37 <?php if (t_is_special($t)) : ?>
38
39 #endif
40 <?php endif; ?>
41 <?php endforeach; ?>
42
43 default:
44 assert(0);
45 break;
46 }
47 }
48