adapted to new em_code module

This commit is contained in:
ceriel 1988-01-14 13:19:32 +00:00
parent d5c423adaf
commit 629fc3f824
4 changed files with 33 additions and 21 deletions

View file

@ -4,7 +4,6 @@ argtype
em_comp.h
m_C_mnem
m_C_mnem_na
m_C_funcs
mkcalls.c
read_em.3
read_em.c

View file

@ -48,13 +48,13 @@ cmp: all
$(COMPARE) man/read_em.3
pr:
@pr Makefile m_C_funcs m_C_mnem m_C_mnem_na argtype $(SRCFILES)
@pr Makefile m_C_mnem m_C_mnem_na argtype $(SRCFILES)
opr:
make pr | opr
clean:
rm -f *.o *.a C_funcs C_mnem C_mnem_narg
rm -f *.o *.a C_mnem C_mnem_narg
libread_emk.a: $(K_OFILES)
ar r libread_emk.a $(K_OFILES)
@ -80,11 +80,11 @@ read_emeV.o: read_em.c em_comp.h reade.c
$(CC) -c $(CFLAGS) -DCHECKING read_em.c
mv read_em.o read_emeV.o
makecalls.o: C_funcs C_mnem C_mnem_narg em_comp.h mkcalls.c
makecalls.o: C_mnem C_mnem_narg em_comp.h mkcalls.c
$(CC) -c $(CFLAGS) mkcalls.c
mv mkcalls.o makecalls.o
makecallsV.o: C_funcs C_mnem C_mnem_narg em_comp.h mkcalls.c
makecallsV.o: C_mnem C_mnem_narg em_comp.h mkcalls.c
$(CC) -c $(CFLAGS) -DCHECKING mkcalls.c
mv mkcalls.o makecallsV.o
@ -94,10 +94,7 @@ C_mnem: m_C_mnem argtype
C_mnem_narg: m_C_mnem_na argtype
sh m_C_mnem_na > C_mnem_narg
C_funcs: m_C_funcs argtype
sh m_C_funcs > C_funcs
lintlib: C_mnem C_mnem_narg C_funcs
lintlib: C_mnem C_mnem_narg
lint $(INCLUDES) $(DEFINES) -DCOMPACT -DCHECKING -Cread_emkV $(KSRCFILES)
lint $(INCLUDES) $(DEFINES) -DCHECKING -Cread_emeV $(ESRCFILES)
mv llib-lread_emeV.ln llib-lread_emkV.ln $(MODULES)/lib

View file

@ -1,6 +1,5 @@
EM_TABLE=../../../etc/em_table
echo "switch(p->em_opcode) {"
echo ' default: EM_error = "Illegal mnemonic"; break;'
for i in - cdflnorswz p b
do
list=`./argtype $i $EM_TABLE`
@ -26,19 +25,22 @@ do
esac
for i in $list
do
echo " case op_$i:"
cat << EOF
case op_$i:
C_$i$args;
break;
EOF
done
echo " (*C_funcs[p->em_opcode])$args; break;"
done
list=`./argtype g $EM_TABLE`
for i in $list
do
echo " case op_$i:"
done
cat << 'EOF'
default:
/* a "g" argument */
if (p->em_argtype == nof_ptyp) {
switch(p->em_opcode) {
default:
EM_error = "Illegal mnemonic";
break;
EOF
for i in $list
do
@ -53,6 +55,9 @@ cat << 'EOF'
}
else if (p->em_argtype == sof_ptyp) {
switch(p->em_opcode) {
default:
EM_error = "Illegal mnemonic";
break;
EOF
for i in $list
do
@ -66,8 +71,21 @@ cat << 'EOF'
}
}
else /*argtype == cst_ptyp */ {
(*C_funcs[p->em_opcode])(p->em_cst);
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'
}
}
}
EOF

View file

@ -21,8 +21,6 @@
extern char em_flag[]; /* One per EM instruction: indicates parameter kind */
extern short em_ptyp[]; /* One per parameter kind: indicates parameter type */
#include "C_funcs"
static int listtype = 0; /* indicates pseudo when generating code for
variable length argument lists
(only for MES)