ack/modules/src/read_em/m_C_mnem

92 lines
1.4 KiB
Text
Raw Normal View History

1987-01-06 11:05:35 +00:00
EM_TABLE=../../../etc/em_table
1987-06-30 12:55:30 +00:00
echo "switch(p->em_opcode) {"
1987-01-06 11:05:35 +00:00
for i in - cdflnorswz p b
do
list=`./argtype $i $EM_TABLE`
case $i in
-) args='()'
1987-06-30 12:55:30 +00:00
echo " /* no arguments */"
1987-01-06 11:05:35 +00:00
;;
cdflnorswz)
1987-06-30 12:55:30 +00:00
args='(p->em_cst)'
echo " /* one integer constant argument */"
1987-01-06 11:05:35 +00:00
;;
p)
1987-06-30 12:55:30 +00:00
args='(p->em_pnam)'
echo " /* a procedure name argument */"
1987-01-06 11:05:35 +00:00
;;
b)
: Grumbl, an instruction label as argument is encoded in a sp_cst2
1987-06-30 12:55:30 +00:00
args='((label) (p->em_cst))'
echo " /* An instruction label argument */"
1987-01-06 11:05:35 +00:00
;;
esac
for i in $list
do
1988-01-14 13:19:32 +00:00
cat << EOF
case op_$i:
C_$i$args;
break;
EOF
1987-01-06 11:05:35 +00:00
done
done
list=`./argtype g $EM_TABLE`
cat << 'EOF'
1988-01-14 13:19:32 +00:00
default:
/* a "g" argument */
1987-06-30 12:55:30 +00:00
if (p->em_argtype == nof_ptyp) {
switch(p->em_opcode) {
1988-01-14 13:19:32 +00:00
default:
EM_error = "Illegal mnemonic";
break;
1987-01-06 11:05:35 +00:00
EOF
for i in $list
do
cat << EOF
case op_$i:
1987-06-30 12:55:30 +00:00
C_${i}_dlb(p->em_dlb, p->em_off);
1987-01-06 11:05:35 +00:00
break;
EOF
done
cat << 'EOF'
}
}
1987-06-30 12:55:30 +00:00
else if (p->em_argtype == sof_ptyp) {
switch(p->em_opcode) {
1988-01-14 13:19:32 +00:00
default:
EM_error = "Illegal mnemonic";
break;
1987-01-06 11:05:35 +00:00
EOF
for i in $list
do
cat << EOF
case op_$i:
1987-06-30 12:55:30 +00:00
C_${i}_dnam(p->em_dnam, p->em_off);
1987-01-06 11:05:35 +00:00
break;
EOF
done
cat << 'EOF'
}
}
1987-06-30 12:55:30 +00:00
else /*argtype == cst_ptyp */ {
1988-01-14 13:19:32 +00:00
switch(p->em_opcode) {
default:
EM_error = "Illegal mnemonic";
break;
EOF
for i in $list
do
cat << EOF
case op_$i:
C_$i(p->em_cst);
break;
EOF
done
cat << 'EOF'
}
1987-06-30 12:55:30 +00:00
}
1987-01-06 11:05:35 +00:00
}
EOF