Pristine Ack-5.5
[Ack-5.5.git] / modules / src / read_em / m_C_mnem
1 EM_TABLE=$1
2 echo "switch(p->em_opcode) {"
3 for i in - cdflnorswz p b
4 do
5         list=`./argtype $i $EM_TABLE`
6         case $i in
7         -)      args='()'
8                 echo "  /* no arguments */"
9                 ;;
10         cdflnorswz)
11                 args='(p->em_cst)'
12                 echo "  /* one integer constant argument */"
13                 ;;
14         p)
15                 args='(p->em_pnam)'
16                 echo "  /* a procedure name argument */"
17                 ;;
18         b)
19
20 : Grumbl, an instruction label as argument is encoded in a sp_cst2
21
22                 args='((label) (p->em_cst))'
23                 echo "  /* An instruction label argument */"
24                 ;;
25         esac
26         for i in $list
27         do
28                 cat << EOF
29         case op_$i:
30                 C_$i$args;
31                 break;
32 EOF
33         done
34 done
35 list=`./argtype g $EM_TABLE`
36 cat << 'EOF'
37         default:
38 /* a "g" argument */
39                 if (p->em_argtype == nof_ptyp) {
40                         switch(p->em_opcode) {
41                                 default:
42                                         EM_error = "Illegal mnemonic";
43                                         break;
44 EOF
45 for i in $list
46 do
47         cat << EOF
48                                 case op_$i:
49                                         C_${i}_dlb(p->em_dlb, p->em_off);
50                                         break;
51 EOF
52 done
53 cat << 'EOF'
54                         }
55                 }
56                 else if (p->em_argtype == sof_ptyp) {
57                         switch(p->em_opcode) {
58                                 default:
59                                         EM_error = "Illegal mnemonic";
60                                         break;
61 EOF
62 for i in $list
63 do
64         cat << EOF
65                                 case op_$i:
66                                         C_${i}_dnam(p->em_dnam, p->em_off);
67                                         break;
68 EOF
69 done
70 cat << 'EOF'
71                         }
72                 }
73                 else /*argtype == cst_ptyp */ {
74                         switch(p->em_opcode) {
75                                 default:
76                                         EM_error = "Illegal mnemonic";
77                                         break;
78 EOF
79 for i in $list
80 do
81         cat << EOF
82                                 case op_$i:
83                                         C_$i(p->em_cst);
84                                         break;
85 EOF
86 done
87 cat << 'EOF'
88                         }
89                 }
90 }
91 EOF