From 629fc3f824a63f3785923efd21a667c6a8ada21b Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 14 Jan 1988 13:19:32 +0000 Subject: [PATCH] adapted to new em_code module --- modules/src/read_em/.distr | 1 - modules/src/read_em/Makefile | 13 +++++------- modules/src/read_em/m_C_mnem | 38 ++++++++++++++++++++++++++--------- modules/src/read_em/mkcalls.c | 2 -- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/modules/src/read_em/.distr b/modules/src/read_em/.distr index 82e634331..a221e0c8e 100644 --- a/modules/src/read_em/.distr +++ b/modules/src/read_em/.distr @@ -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 diff --git a/modules/src/read_em/Makefile b/modules/src/read_em/Makefile index d397600ed..4f9396d18 100644 --- a/modules/src/read_em/Makefile +++ b/modules/src/read_em/Makefile @@ -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 diff --git a/modules/src/read_em/m_C_mnem b/modules/src/read_em/m_C_mnem index 479da76db..fdd52f64f 100755 --- a/modules/src/read_em/m_C_mnem +++ b/modules/src/read_em/m_C_mnem @@ -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' - /* a "g" argument */ + 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); - break; + 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 diff --git a/modules/src/read_em/mkcalls.c b/modules/src/read_em/mkcalls.c index 016b32ab7..9ea5942aa 100644 --- a/modules/src/read_em/mkcalls.c +++ b/modules/src/read_em/mkcalls.c @@ -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)