completely new version
authorceriel <none@none>
Thu, 12 Nov 1987 11:59:31 +0000 (11:59 +0000)
committerceriel <none@none>
Thu, 12 Nov 1987 11:59:31 +0000 (11:59 +0000)
52 files changed:
modules/src/em_code/.distr
modules/src/em_code/C_out.c [new file with mode: 0644]
modules/src/em_code/Makefile
modules/src/em_code/bhcst.c [new file with mode: 0644]
modules/src/em_code/bhdlb.c [new file with mode: 0644]
modules/src/em_code/bhdnam.c [new file with mode: 0644]
modules/src/em_code/bhfcon.c [new file with mode: 0644]
modules/src/em_code/bhicon.c [new file with mode: 0644]
modules/src/em_code/bhilb.c [new file with mode: 0644]
modules/src/em_code/bhpnam.c [new file with mode: 0644]
modules/src/em_code/bhucon.c [new file with mode: 0644]
modules/src/em_code/convert.c [new file with mode: 0644]
modules/src/em_code/crcst.c [new file with mode: 0644]
modules/src/em_code/crdlb.c [new file with mode: 0644]
modules/src/em_code/crdnam.c [new file with mode: 0644]
modules/src/em_code/crfcon.c [new file with mode: 0644]
modules/src/em_code/cricon.c [new file with mode: 0644]
modules/src/em_code/crilb.c [new file with mode: 0644]
modules/src/em_code/crpnam.c [new file with mode: 0644]
modules/src/em_code/crscon.c [new file with mode: 0644]
modules/src/em_code/crucon.c [new file with mode: 0644]
modules/src/em_code/cst.c [new file with mode: 0644]
modules/src/em_code/dfdlb.c [new file with mode: 0644]
modules/src/em_code/dfdnam.c [new file with mode: 0644]
modules/src/em_code/dfilb.c [new file with mode: 0644]
modules/src/em_code/dlb.c [new file with mode: 0644]
modules/src/em_code/dnam.c [new file with mode: 0644]
modules/src/em_code/em.nogen
modules/src/em_code/em_code.3X
modules/src/em_code/end.c [new file with mode: 0644]
modules/src/em_code/endarg.c [new file with mode: 0644]
modules/src/em_code/exc.c [new file with mode: 0644]
modules/src/em_code/fcon.c [new file with mode: 0644]
modules/src/em_code/icon.c [new file with mode: 0644]
modules/src/em_code/ilb.c [new file with mode: 0644]
modules/src/em_code/msend.c [new file with mode: 0644]
modules/src/em_code/msstart.c [new file with mode: 0644]
modules/src/em_code/op.c [new file with mode: 0644]
modules/src/em_code/opcst.c [new file with mode: 0644]
modules/src/em_code/opdlb.c [new file with mode: 0644]
modules/src/em_code/opdnam.c [new file with mode: 0644]
modules/src/em_code/opilb.c [new file with mode: 0644]
modules/src/em_code/opnarg.c [new file with mode: 0644]
modules/src/em_code/oppnam.c [new file with mode: 0644]
modules/src/em_code/pnam.c [new file with mode: 0644]
modules/src/em_code/pro.c [new file with mode: 0644]
modules/src/em_code/pronarg.c [new file with mode: 0644]
modules/src/em_code/psdlb.c [new file with mode: 0644]
modules/src/em_code/psdnam.c [new file with mode: 0644]
modules/src/em_code/pspnam.c [new file with mode: 0644]
modules/src/em_code/scon.c [new file with mode: 0644]
modules/src/em_code/ucon.c [new file with mode: 0644]

index 0f60b57..9501309 100644 (file)
@@ -1,13 +1,61 @@
 Makefile
+C_out.c
+bhcst.c
+bhdlb.c
+bhdnam.c
+bhfcon.c
+bhicon.c
+bhilb.c
+bhpnam.c
+bhucon.c
+convert.c
+crcst.c
+crdlb.c
+crdnam.c
+crfcon.c
+cricon.c
+crilb.c
+crpnam.c
+crscon.c
+crucon.c
+cst.c
+dfdlb.c
+dfdnam.c
+dfilb.c
+dlb.c
+dnam.c
 e
 em.nogen
-em_code.3X
-k
-make.em.gen
-make.fun
+end.c
+endarg.c
+exc.c
 failed.c
+fcon.c
 getid.c
+icon.c
+ilb.c
 insert.c
+insert.h
 internerr.c
 io.c
-insert.h
+k
+make.em.gen
+make.sh
+msend.c
+msstart.c
+op.c
+opcst.c
+opdlb.c
+opdnam.c
+opilb.c
+opnarg.c
+oppnam.c
+pnam.c
+pro.c
+pronarg.c
+psdlb.c
+psdnam.c
+pspnam.c
+scon.c
+ucon.c
+em_code.3X
diff --git a/modules/src/em_code/C_out.c b/modules/src/em_code/C_out.c
new file mode 100644 (file)
index 0000000..0f11354
--- /dev/null
@@ -0,0 +1,173 @@
+#include <em.h>
+#include <em_comp.h>
+#include <em_pseu.h>
+#include <em_flag.h>
+#include <em_ptyp.h>
+#include <em_private.h>
+
+static arg();
+static pseudo();
+
+extern char em_flag[];
+
+struct e_instr *
+C_alloc()
+{
+       static struct e_instr b;
+
+       return &b;
+}
+
+C_out(p)
+       register struct e_instr *p;
+{
+       /*      Generate EM-code from the e_instr structure "p"
+       */
+
+       switch(p->em_type) {
+       case EM_MNEM:
+               OP(p->em_opcode);
+               if (em_flag[p->em_opcode] == PAR_B) {
+                       p->em_argtype = ilb_ptyp;
+                       p->em_ilb = p->em_cst;
+               }
+               if (em_flag[p->em_opcode] != PAR_NO) arg(p, 0);
+               NL();
+               break;
+
+       case EM_PSEU:
+               pseudo(p);
+               break;
+
+       case EM_STARTMES:
+               PS(ps_mes);
+               CST(p->em_cst);
+               break;
+
+       case EM_MESARG:
+               arg(p, 1);
+               break;
+
+       case EM_ENDMES:
+               CEND();
+               NL();
+               break;
+
+       case EM_DEFILB:
+               DFILB(p->em_ilb);
+               NL();
+               break;
+
+       case EM_DEFDLB:
+               DFDLB(p->em_dlb);
+               NL();
+               break;
+
+       case EM_DEFDNAM:
+               DFDNAM(p->em_dnam);
+               NL();
+               break;
+
+       }
+}
+
+static
+arg(p, comma)
+       register struct e_instr *p;
+{
+       /*      Output the argument of "p".
+       */
+
+       if (comma) COMMA();
+
+       switch(p->em_argtype) {
+       case 0:
+               CCEND();
+               break;
+
+       case ilb_ptyp:
+               ILB(p->em_ilb);
+               break;
+
+       case nof_ptyp:
+               DOFF(p->em_dlb, p->em_off);
+               break;
+
+       case sof_ptyp:
+               NOFF(p->em_dnam, p->em_off);
+               break;
+
+       case cst_ptyp:
+               CST(p->em_cst);
+               break;
+
+       case pro_ptyp:
+               PNAM(p->em_pnam);
+               break;
+
+       case str_ptyp:
+               SCON(p->em_string, p->em_size);
+               break;
+
+       case ico_ptyp:
+               WCON(sp_icon, p->em_string, p->em_size);
+               break;
+
+       case uco_ptyp:
+               WCON(sp_ucon, p->em_string, p->em_size);
+               break;
+
+       case fco_ptyp:
+               WCON(sp_fcon, p->em_string, p->em_size);
+               break;
+
+       }
+}
+
+static
+pseudo(p)
+       register struct e_instr *p;
+{
+
+       PS(p->em_opcode);
+
+       switch(p->em_opcode) {
+       case ps_exc:
+               CST(p->em_exc1);
+               COMMA();
+               CST(p->em_exc2);
+               break;
+
+       case ps_rom:
+       case ps_con:
+               arg(p, 0);
+               CEND();
+               break;
+
+       case ps_bss:
+       case ps_hol:
+               CST(EM_holsize);
+               arg(p, 1);
+               COMMA();
+               CST((arith) EM_holinit);
+               break;
+
+       case ps_pro:
+               arg(p, 0);
+               COMMA();
+               if (p->em_nlocals != -1) CST(p->em_nlocals);
+               else    CCEND();
+               break;
+
+       case ps_end:
+               if (p->em_argtype == 0) CCEND();
+               else CST(p->em_cst);
+               break;
+
+       default:
+               arg(p, 0);
+               break;
+       }
+
+       NL();
+}
index 3e164fe..b9cde9c 100644 (file)
@@ -1,43 +1,52 @@
 EMHOME = ../../..
+ETC = $(EMHOME)/etc
 INSTALL = $(EMHOME)/modules/install
 COMPARE = $(EMHOME)/modules/compare
-CFLAGS = -I$(EMHOME)/h -I$(EMHOME)/modules/h -O
-SRC = failed.c insert.c internerr.c getid.c
+CFLAGS = -I$(EMHOME)/h -I$(EMHOME)/modules/h -I. -O
+AR = ar
+SRC =  bhcst.c bhdlb.c bhdnam.c bhfcon.c bhicon.c bhilb.c bhpnam.c bhucon.c \
+       crcst.c crdlb.c crdnam.c crfcon.c cricon.c crilb.c crpnam.c crscon.c \
+       crucon.c cst.c dfdlb.c dfdnam.c dfilb.c dlb.c dnam.c end.c endarg.c \
+       exc.c failed.c fcon.c getid.c icon.c ilb.c insert.c internerr.c io.c \
+       msend.c op.c opcst.c opdlb.c opdnam.c opilb.c opnarg.c oppnam.c pnam.c \
+       pro.c pronarg.c msstart.c psdlb.c psdnam.c pspnam.c scon.c ucon.c \
+       C_out.c
+
 OBS = failed.o insert.o internerr.o getid.o
 
-all:           libeme.a libemk.a em_code.3
+all:           libeme.a libemk.a em_code.3 em_codeEK.h
                rm -f C_*.c
 
 install:       all
                $(INSTALL) lib/libeme.a
                $(INSTALL) lib/libemk.a
                $(INSTALL) man/em_code.3
+               $(INSTALL) h/em_codeEK.h
 
 compare:       all
                $(COMPARE) lib/libeme.a
                $(COMPARE) lib/libemk.a
                $(COMPARE) man/em_code.3
+               $(COMPARE) h/em_codeEK.h
 
 em_code.3:     em_code.3X
                -sh -c 'tbl < em_code.3X > em_code.3'
                -sh -c 'if test -s em_code.3 ; then : ; else cp em_code.3X em_code.3 ; fi '
 
-libeme.a:      make.sh e/em_private.h e/em.c $(OBS) io.c
-               EMHOME=$(EMHOME); export EMHOME; sh make.sh e
+libeme.a:      e/em_private.h e/em.c $(OBS) io.c
+               EMHOME=$(EMHOME); cc="$(CC)"; cflags="-c -Ie $(CFLAGS)" ar="$(AR)"; export EMHOME cc ar cflags; sh make.sh e
                -sh -c 'ranlib libeme.a'
 
-libemk.a:      make.sh k/em_private.h k/em.c $(OBS) io.c
-               EMHOME=$(EMHOME); export EMHOME; sh make.sh k
+libemk.a:      k/em_private.h k/em.c $(OBS) io.c
+               EMHOME=$(EMHOME); cc="$(CC)"; cflags="-c -Ik $(CFLAGS)" ar="$(AR)"; export EMHOME cc ar cflags; sh make.sh k
                -sh -c 'ranlib libemk.a'
 
-make.sh:       em.gen em.nogen make.fun
-               make.fun em.gen em.nogen | sh
-
-em.gen:                make.em.gen $(EMHOME)/etc/em_table
-               make.em.gen $(EMHOME)/etc/em_table > em.gen
+em_codeEK.h:   make.em.gen $(ETC)/em_table em.nogen
+               make.em.gen $(ETC)/em_table > em_codeEK.h
+               cat em.nogen >> em_codeEK.h
 
 pr:
-               @pr Makefile make.em.gen make.fun em.nogen insert.h $(SRC) e/em_private.h e/em.c k/em_private.h k/em.c
+               @pr Makefile em.nogen make.em.gen make.sh insert.h $(SRC) e/em_private.h e/em.c k/em_private.h k/em.c
 
 opr:
                make pr | opr
@@ -45,9 +54,7 @@ opr:
 # don't put the next "rm"s all on one line. the argument list then
 # becomes too long for some systems
 clean:
-               rm -f *.o
-               rm -f C_*.c
-               rm -f *.a em_code.3 em.gen make.sh
+               rm -f *.o *.a em_code.3
 
 lintlib:       make.sh
                lint -I. -I../../h -I../../../h -Ie -Ceme $(SRC) e/*.c
diff --git a/modules/src/em_code/bhcst.c b/modules/src/em_code/bhcst.c
new file mode 100644 (file)
index 0000000..76e730b
--- /dev/null
@@ -0,0 +1,17 @@
+#include "em_private.h"
+
+CC_bhcst(op, n, w, i)
+       arith n;
+       arith w;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value a cst w, and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       CST(w);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhdlb.c b/modules/src/em_code/bhdlb.c
new file mode 100644 (file)
index 0000000..3b7a701
--- /dev/null
@@ -0,0 +1,19 @@
+#include "em_private.h"
+
+CC_bhdlb(op, n, s, off, i)
+       arith n;
+       label s;
+       arith off;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value a dlb(s, off),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       DOFF(s, off);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhdnam.c b/modules/src/em_code/bhdnam.c
new file mode 100644 (file)
index 0000000..27b3d85
--- /dev/null
@@ -0,0 +1,19 @@
+#include "em_private.h"
+
+CC_bhdnam(op, n, s, off, i)
+       arith n;
+       char *s;
+       arith off;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value a dnam(s, off),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       NOFF(s, off);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhfcon.c b/modules/src/em_code/bhfcon.c
new file mode 100644 (file)
index 0000000..3296cc2
--- /dev/null
@@ -0,0 +1,19 @@
+#include "em_private.h"
+
+CC_bhfcon(op, n, s, sz, i)
+       arith n;
+       char *s;
+       arith sz;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value an FCON (s, sz),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       WCON(sp_fcon, s, sz);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhicon.c b/modules/src/em_code/bhicon.c
new file mode 100644 (file)
index 0000000..e5e935c
--- /dev/null
@@ -0,0 +1,19 @@
+#include "em_private.h"
+
+CC_bhicon(op, n, s, sz, i)
+       arith n;
+       char *s;
+       arith sz;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value an ICON (s, sz),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       WCON(sp_icon, s, sz);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhilb.c b/modules/src/em_code/bhilb.c
new file mode 100644 (file)
index 0000000..5cf595e
--- /dev/null
@@ -0,0 +1,18 @@
+#include "em_private.h"
+
+CC_bhilb(op, n, l, i)
+       arith n;
+       label l;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value a ILB(l),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       ILB(l);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhpnam.c b/modules/src/em_code/bhpnam.c
new file mode 100644 (file)
index 0000000..2df31ab
--- /dev/null
@@ -0,0 +1,18 @@
+#include "em_private.h"
+
+CC_bhpnam(op, n, p, i)
+       arith n;
+       char *p;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value a PNAM(p),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       PNAM(p);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/bhucon.c b/modules/src/em_code/bhucon.c
new file mode 100644 (file)
index 0000000..f4b7050
--- /dev/null
@@ -0,0 +1,19 @@
+#include "em_private.h"
+
+CC_bhucon(op, n, s, sz, i)
+       arith n;
+       char *s;
+       arith sz;
+       int i;
+{
+       /*      BSS or HOL with size n, initial value an UCON (s, sz),
+               and flag i
+       */
+       PS(op);
+       CST(n);
+       COMMA();
+       WCON(sp_ucon, s, sz);
+       COMMA();
+       CST((arith) i);
+       NL();
+}
diff --git a/modules/src/em_code/convert.c b/modules/src/em_code/convert.c
new file mode 100644 (file)
index 0000000..a801fb1
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+#ifndef NORCSID
+static char rcsid[] = "$Header$";
+#endif
+
+/*     This program converts either human-readable or compact EM
+       assembly code to calls of the procedure-interface.
+       It must be linked with two libraries:
+       - a library to read EM code, according to read_em(3)
+       - a library implementing the em_code(3) interface.
+       Thus, this program could serve as an EM_encoder, an
+       EM_decoder, or some code generator, depending on how it is
+       linked.
+*/
+
+#include       <system.h>
+#include        <em_pseu.h>
+#include       <em_mnem.h>
+#include        <em_spec.h>
+#include        <em_flag.h>
+#include        <em_ptyp.h>
+#include       <em.h>
+#include       <em_comp.h>
+
+char *filename;                        /* Name of input file */
+int errors;                    /* Number of errors */
+
+main(argc,argv)
+       char **argv;
+{
+       struct e_instr buf;
+       register struct e_instr *p = &buf;
+
+       if (argc >= 2) {
+               filename = argv[1];
+       }
+       else    filename = 0;
+       if (!EM_open(filename)) {
+               fatal(EM_error);
+       }
+       EM_getinstr(p);
+       C_init((arith) EM_wordsize, (arith) EM_pointersize);
+       if (argc >= 3) {
+               if (!C_open(argv[2])) {
+                       fatal("C_open failed");
+               }
+       }
+       else    if (!C_open( (char *) 0)) fatal("C_open failed");
+       C_magic();
+       while (p->em_type != EM_EOF) {
+               if (p->em_type == EM_FATAL) {
+                       fatal("%s", EM_error);
+               }
+               if (EM_error) {
+                       error("%s", EM_error);
+               }
+               if (p->em_type != EM_ERROR) {
+                       EM_mkcalls(p);
+               }
+               EM_getinstr(p);
+       }
+       C_close();
+       EM_close();
+       exit(errors);
+}
+
+/* VARARGS */
+error(s,a1,a2,a3,a4)
+       char *s;
+{
+       fprint(STDERR,
+               "%s, line %d: ",
+               filename ? filename : "standard input",
+               EM_lineno);
+       fprint(STDERR,s,a1,a2,a3,a4);
+       fprint(STDERR, "\n");
+       errors++;
+}
+
+/* VARARGS */
+fatal(s,a1,a2,a3,a4)
+       char *s;
+{
+       error(s,a1,a2,a3,a4);
+       exit(1);
+}
diff --git a/modules/src/em_code/crcst.c b/modules/src/em_code/crcst.c
new file mode 100644 (file)
index 0000000..402efcd
--- /dev/null
@@ -0,0 +1,12 @@
+#include "em_private.h"
+
+CC_crcst(op, v)
+       arith v;
+{
+       /*      CON or ROM with argument CST(v)
+       */
+       PS(op);
+       CST(v);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crdlb.c b/modules/src/em_code/crdlb.c
new file mode 100644 (file)
index 0000000..49d1a1b
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_crdlb(op, v, off)
+       label v;
+       arith off;
+{
+       /*      CON or ROM with argument DLB(v, off)
+       */
+       PS(op);
+       DOFF(v, off);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crdnam.c b/modules/src/em_code/crdnam.c
new file mode 100644 (file)
index 0000000..735563a
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_crdnam(op, s, off)
+       char *s;
+       arith off;
+{
+       /*      CON or ROM with argument DNAM(s, off)
+       */
+       PS(op);
+       NOFF(s, off);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crfcon.c b/modules/src/em_code/crfcon.c
new file mode 100644 (file)
index 0000000..c115b2a
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_crfcon(op, v, s)
+       char *v;
+       arith s;
+{
+       /*      CON or ROM with argument FCON(v,z)
+       */
+       PS(op);
+       WCON(sp_fcon, v, s);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/cricon.c b/modules/src/em_code/cricon.c
new file mode 100644 (file)
index 0000000..d1af51c
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_cricon(op, v, s)
+       char *v;
+       arith s;
+{
+       /*      CON or ROM with argument ICON(v,z)
+       */
+       PS(op);
+       WCON(sp_icon, v, s);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crilb.c b/modules/src/em_code/crilb.c
new file mode 100644 (file)
index 0000000..63e39b9
--- /dev/null
@@ -0,0 +1,12 @@
+#include "em_private.h"
+
+CC_crilb(op, l)
+       label l;
+{
+       /*      CON or ROM with argument ILB(l)
+       */
+       PS(op);
+       ILB(l);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crpnam.c b/modules/src/em_code/crpnam.c
new file mode 100644 (file)
index 0000000..8fe75a7
--- /dev/null
@@ -0,0 +1,12 @@
+#include "em_private.h"
+
+CC_crpnam(op, p)
+       char *p;
+{
+       /*      CON or ROM with argument PNAM(p)
+       */
+       PS(op);
+       PNAM(p);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crscon.c b/modules/src/em_code/crscon.c
new file mode 100644 (file)
index 0000000..1b77c46
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_crscon(op, v, s)
+       char *v;
+       arith s;
+{
+       /*      CON or ROM with argument SCON(v,z)
+       */
+       PS(op);
+       SCON(v, s);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/crucon.c b/modules/src/em_code/crucon.c
new file mode 100644 (file)
index 0000000..aa0ef1a
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_crucon(op, v, s)
+       char *v;
+       arith s;
+{
+       /*      CON or ROM with argument UCON(v,z)
+       */
+       PS(op);
+       WCON(sp_ucon, v, s);
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/cst.c b/modules/src/em_code/cst.c
new file mode 100644 (file)
index 0000000..e5f8606
--- /dev/null
@@ -0,0 +1,8 @@
+#include "em_private.h"
+
+CC_cst(l)
+       arith l;
+{
+       COMMA();
+       CST(l);
+}
diff --git a/modules/src/em_code/dfdlb.c b/modules/src/em_code/dfdlb.c
new file mode 100644 (file)
index 0000000..e29affb
--- /dev/null
@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_dfdlb(l)
+       label l;
+{
+       /*      Define numeric data label
+       */
+       DFDLB(l);
+       NL();
+}
diff --git a/modules/src/em_code/dfdnam.c b/modules/src/em_code/dfdnam.c
new file mode 100644 (file)
index 0000000..c49c676
--- /dev/null
@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_dfdnam(s)
+       char *s;
+{
+       /*      Define data label
+       */
+       DFDNAM(s);
+       NL();
+}
diff --git a/modules/src/em_code/dfilb.c b/modules/src/em_code/dfilb.c
new file mode 100644 (file)
index 0000000..14bb79c
--- /dev/null
@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_dfilb(l)
+       label l;
+{
+       /*      Define instruction label
+       */
+       DFILB(l);
+       NL();
+}
diff --git a/modules/src/em_code/dlb.c b/modules/src/em_code/dlb.c
new file mode 100644 (file)
index 0000000..75018dc
--- /dev/null
@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_dlb(l, val)
+       label l;
+       arith val;
+{
+       COMMA();
+       DOFF(l, val);
+}
diff --git a/modules/src/em_code/dnam.c b/modules/src/em_code/dnam.c
new file mode 100644 (file)
index 0000000..95388c1
--- /dev/null
@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_dnam(str, val)
+       char *str;
+       arith val;
+{
+       COMMA();
+       NOFF(str, val);
+}
index 296b65f..156299b 100644 (file)
-% Definition of EM procedural interface: hand-written definitions
+/* Definition of EM procedural interface: hand-written definitions
 
-% C_open       | char *:filename       | <hand-written>
-% C_busy       |       | <hand-written>
-% C_close      |       | <hand-written>
-% C_magic      |       | <hand-written>
+  C_open       | char *:filename       | <hand-written>
+  C_busy       |       | <hand-written>
+  C_close      |       | <hand-written>
+  C_magic      |       | <hand-written>
+*/
 
-C_df_dlb       | label:l       | DFDLB(l); NL()
-C_df_dnam      | char *:s      | DFDNAM(s); NL()
-C_df_ilb       | label:l       | DFILB(l); NL()
+#define C_df_dlb(l)    CC_dfdlb(l)
+#define C_df_dnam(s)   CC_dfdnam(s)
+#define C_df_ilb(l)    CC_dfilb(l)
 
-C_pro          | char *:s arith:l      |
-       PS(ps_pro); PNAM(s); COMMA(); CST(l); NL()
-C_pro_narg     | char *:s              |
-       PS(ps_pro); PNAM(s); COMMA(); CCEND(); NL()
-C_end          | arith:l               | PS(ps_end); CST(l); NL()
-C_end_narg     |                       | PS(ps_end); CCEND(); NL()
+#define C_pro(s,l)     CC_pro(s, l)
+#define C_pro_narg(s)  CC_pronarg(s)
+#define C_end(l)       CC_end(l)
+#define C_end_narg()   CC_endnarg()
 
-C_exa_dnam     | char *:s      | PS(ps_exa); DNAM(s); NL()
-C_exa_dlb      | label:l       | PS(ps_exa); DLB(l); NL()
-C_exp          | char *:s      | PS(ps_exp); PNAM(s); NL()
-C_ina_dnam     | char *:s      | PS(ps_ina); DNAM(s); NL()
-C_ina_dlb      | label:l       | PS(ps_ina); DLB(l); NL()
-C_inp          | char *:s      | PS(ps_inp); PNAM(s); NL()
+#define C_exa_dnam(s)  CC_psdnam(ps_exa, s)
+#define C_exa_dlb(l)   CC_psdlb(ps_exa, l)
+#define C_ina_dnam(s)  CC_psdnam(ps_ina, s)
+#define C_ina_dlb(l)   CC_psdlb(ps_ina, l)
+#define C_exp(s)       CC_pspnam(ps_exp, s)
+#define C_inp(s)       CC_pspnam(ps_inp, s)
 
-C_bss_cst      | arith:n arith:w int:i |
-       PS(ps_bss); CST(n); COMMA(); CST(w); COMMA(); CST((arith) i); NL()
-C_bss_icon     | arith:n char *:s arith:sz int:i       |
-       PS(ps_bss); CST(n); COMMA(); WCON(sp_icon, s, sz); COMMA(); CST((arith) i); NL()
-C_bss_ucon     | arith:n char *:s arith:sz int:i       |
-       PS(ps_bss); CST(n); COMMA(); WCON(sp_ucon, s, sz); COMMA(); CST((arith) i); NL()
-C_bss_fcon     | arith:n char *:s arith:sz int:i       |
-       PS(ps_bss); CST(n); COMMA(); WCON(sp_fcon, s, sz); COMMA(); CST((arith) i); NL()
-C_bss_dnam     | arith:n char *:s arith:offs int:i     |
-       PS(ps_bss); CST(n); COMMA(); NOFF(s, offs); COMMA(); CST((arith) i); NL()
-C_bss_dlb      | arith:n label:l arith:offs int:i      |
-       PS(ps_bss); CST(n); COMMA(); DOFF(l, offs); COMMA(); CST((arith) i); NL()
-C_bss_ilb      | arith:n label:l int:i                 |
-       PS(ps_bss); CST(n); COMMA(); ILB(l); COMMA(); CST((arith) i); NL()
-C_bss_pnam     | arith:n char *:s int:i                |
-       PS(ps_bss); CST(n); COMMA(); PNAM(s); COMMA(); CST((arith) i); NL()
+#define C_bss_cst(n,w,i)       CC_bhcst(ps_bss, n, w, i)
+#define C_hol_cst(n,w,i)       CC_bhcst(ps_hol, n, w, i)
+#define C_bss_icon(n,s,sz,i)   CC_bhicon(ps_bss,n,s,sz,i)
+#define C_hol_icon(n,s,sz,i)   CC_bhicon(ps_hol,n,s,sz,i)
+#define C_bss_ucon(n,s,sz,i)   CC_bhucon(ps_bss,n,s,sz,i)
+#define C_hol_ucon(n,s,sz,i)   CC_bhucon(ps_hol,n,s,sz,i)
+#define C_bss_fcon(n,s,sz,i)   CC_bhfcon(ps_bss,n,s,sz,i)
+#define C_hol_fcon(n,s,sz,i)   CC_bhfcon(ps_hol,n,s,sz,i)
+#define C_bss_dnam(n,s,off,i)  CC_bhdnam(ps_bss,n,s,off,i)
+#define C_hol_dnam(n,s,off,i)  CC_bhdnam(ps_hol,n,s,off,i)
+#define C_bss_dlb(n,l,off,i)   CC_bhdlb(ps_bss,n,l,off,i)
+#define C_hol_dlb(n,l,off,i)   CC_bhdlb(ps_hol,n,l,off,i)
+#define C_bss_ilb(n,l,i)       CC_bhilb(ps_bss,n,l,i)
+#define C_hol_ilb(n,l,i)       CC_bhilb(ps_hol,n,l,i)
+#define C_bss_pnam(n,s,i)      CC_bhpnam(ps_bss,n,s,i)
+#define C_hol_pnam(n,s,i)      CC_bhpnam(ps_hol,n,s,i)
 
-C_hol_cst      | arith:n arith:w int:i |
-       PS(ps_hol); CST(n); COMMA(); CST(w); COMMA(); CST((arith) i); NL()
-C_hol_icon     | arith:n char *:s arith:sz int:i       |
-       PS(ps_hol); CST(n); COMMA(); WCON(sp_icon, s, sz); COMMA(); CST((arith) i); NL()
-C_hol_ucon     | arith:n char *:s arith:sz int:i       |
-       PS(ps_hol); CST(n); COMMA(); WCON(sp_ucon, s, sz); COMMA(); CST((arith) i); NL()
-C_hol_fcon     | arith:n char *:s arith:sz int:i       |
-       PS(ps_hol); CST(n); COMMA(); WCON(sp_fcon, s, sz); COMMA(); CST((arith) i); NL()
-C_hol_dnam     | arith:n char *:s arith:offs int:i     |
-       PS(ps_hol); CST(n); COMMA(); NOFF(s, offs); COMMA(); CST((arith) i); NL()
-C_hol_dlb      | arith:n label:l arith:offs int:i      |
-       PS(ps_hol); CST(n); COMMA(); DOFF(l, offs); COMMA(); CST((arith) i); NL()
-C_hol_ilb      | arith:n label:l int:i                 |
-       PS(ps_hol); CST(n); COMMA(); ILB(l); COMMA(); CST((arith) i); NL()
-C_hol_pnam     | arith:n char *:s int:i                |
-       PS(ps_hol); CST(n); COMMA(); PNAM(s); COMMA(); CST((arith) i); NL()
+#define C_con_cst(v)   CC_crcst(ps_con,v)
+#define C_con_icon(v,s)        CC_cricon(ps_con,v,s)
+#define C_con_ucon(v,s)        CC_crucon(ps_con,v,s)
+#define C_con_fcon(v,s)        CC_crfcon(ps_con,v,s)
+#define C_con_scon(v,s)        CC_crscon(ps_con,v,s)
+#define C_con_dnam(v,s)        CC_crdnam(ps_con,v,s)
+#define C_con_dlb(v,s) CC_crdlb(ps_con,v,s)
+#define C_con_ilb(v)   CC_crilb(ps_con,v)
+#define C_con_pnam(v)  CC_crpnam(ps_con,v)
 
-C_con_cst      | arith:l               | PS(ps_con); CST(l); CEND(); NL()
-C_con_icon     | char *:val arith:siz  |
-       PS(ps_con); WCON(sp_icon, val, siz); CEND(); NL()
-C_con_ucon     | char *:val arith:siz  |
-       PS(ps_con); WCON(sp_ucon, val, siz); CEND(); NL()
-C_con_fcon     | char *:val arith:siz  |
-       PS(ps_con); WCON(sp_fcon, val, siz); CEND(); NL()
-C_con_scon     | char *:str arith:siz  |
-       PS(ps_con); SCON(str, siz); CEND(); NL()
-C_con_dnam     | char *:str arith:val  |
-       PS(ps_con); NOFF(str, val); CEND(); NL()
-C_con_dlb      | label:l arith:val     |
-       PS(ps_con); DOFF(l, val); CEND(); NL()
-C_con_ilb      | label:l               | PS(ps_con); ILB(l); CEND(); NL()
-C_con_pnam     | char *:str            | PS(ps_con); PNAM(str); CEND(); NL()
+#define C_rom_cst(v)   CC_crcst(ps_rom,v)
+#define C_rom_icon(v,s)        CC_cricon(ps_rom,v,s)
+#define C_rom_ucon(v,s)        CC_crucon(ps_rom,v,s)
+#define C_rom_fcon(v,s)        CC_crfcon(ps_rom,v,s)
+#define C_rom_scon(v,s)        CC_crscon(ps_rom,v,s)
+#define C_rom_dnam(v,s)        CC_crdnam(ps_rom,v,s)
+#define C_rom_dlb(v,s) CC_crdlb(ps_rom,v,s)
+#define C_rom_ilb(v)   CC_crilb(ps_rom,v)
+#define C_rom_pnam(v)  CC_crpnam(ps_rom,v)
 
-C_rom_cst      | arith:l               | PS(ps_rom); CST(l); CEND(); NL()
-C_rom_icon     | char *:val arith:siz  |
-       PS(ps_rom); WCON(sp_icon, val, siz); CEND(); NL()
-C_rom_ucon     | char *:val arith:siz  |
-       PS(ps_rom); WCON(sp_ucon, val, siz); CEND(); NL()
-C_rom_fcon     | char *:val arith:siz  |
-       PS(ps_rom); WCON(sp_fcon, val, siz); CEND(); NL()
-C_rom_scon     | char *:str arith:siz  |
-       PS(ps_rom); SCON(str, siz); CEND(); NL()
-C_rom_dnam     | char *:str arith:val  |
-       PS(ps_rom); NOFF(str, val); CEND(); NL()
-C_rom_dlb      | label:l arith:val     |
-       PS(ps_rom); DOFF(l, val); CEND(); NL()
-C_rom_ilb      | label:l               | PS(ps_rom); ILB(l); CEND(); NL()
-C_rom_pnam     | char *:str            | PS(ps_rom); PNAM(str); CEND(); NL()
+#define C_cst(l)       CC_cst(l)
+#define C_icon(v,s)    CC_icon(v,s)
+#define C_ucon(v,s)    CC_ucon(v,s)
+#define C_fcon(v,s)    CC_fcon(v,s)
+#define C_scon(v,s)    CC_scon(v,s)
+#define C_dnam(v,s)    CC_dnam(v,s)
+#define C_dlb(v,s)     CC_dlb(v,s)
+#define C_ilb(l)       CC_ilb(l)
+#define C_pnam(s)      CC_pnam(s)
 
-C_cst  | arith:l               | COMMA(); CST(l)
-C_icon | char *:val arith:siz  | COMMA(); WCON(sp_icon, val, siz)
-C_ucon | char *:val arith:siz  | COMMA(); WCON(sp_ucon, val, siz)
-C_fcon | char *:val arith:siz  | COMMA(); WCON(sp_fcon, val, siz)
-C_scon | char *:str arith:siz  | COMMA(); SCON(str, siz)
-C_dnam | char *:str arith:val  | COMMA(); NOFF(str, val)
-C_dlb  | label:l arith:val     | COMMA(); DOFF(l, val)
-C_ilb  | label:l               | COMMA(); ILB(l)
-C_pnam | char *:str            | COMMA(); PNAM(str)
+#define C_mes_begin(ms)        CC_msstart(ms)
+#define C_mes_end()    CC_msend()
 
-C_mes_begin    | int:ms        | PS(ps_mes); CST((arith)ms)
-C_mes_end      |               | CEND(); NL()
+#define C_exc(c1,c2)   CC_exc(c1,c2)
 
-% Yes, there really is a C_exc routine...
-C_exc  | arith:c1 arith:c2     | PS(ps_exc); CST(c1); COMMA(); CST(c2); NL()
+#ifndef ps_rom
+#include <em_pseu.h>
+#endif
+
+#ifndef op_lol
+#include <em_mnem.h>
+#endif
index f7fecde..5c0ba48 100644 (file)
@@ -472,6 +472,9 @@ mechanism, the routine
 .I C_internal_error
 is called. Again, the user can override its default definition by supplying his
 own. Such errors, however, are caused by a programming error of the user.
+.SH REMARKS
+Some of the routines in this module may be implemented as macros. So,
+do not try to take the address of these functions.
 .SH BUGS
 It is not possible to indicate that the argument of
 .B C_con_cst ()
diff --git a/modules/src/em_code/end.c b/modules/src/em_code/end.c
new file mode 100644 (file)
index 0000000..a8e0e4b
--- /dev/null
@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_end(l)
+       arith l;
+{
+       /*      END pseudo of procedure with l locals
+       */
+       PS(ps_end);
+       CST(l);
+       NL();
+}
diff --git a/modules/src/em_code/endarg.c b/modules/src/em_code/endarg.c
new file mode 100644 (file)
index 0000000..b7f8db0
--- /dev/null
@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_endnarg()
+{
+       /*      END pseudo of procedure with unknown # of locals
+       */
+       PS(ps_end);
+       CCEND();
+       NL();
+}
diff --git a/modules/src/em_code/exc.c b/modules/src/em_code/exc.c
new file mode 100644 (file)
index 0000000..7f83aaa
--- /dev/null
@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_exc(c1,c2)
+       arith c1,c2;
+{
+       PS(ps_exc);
+       CST(c1);
+       COMMA();
+       CST(c2);
+       NL();
+}
diff --git a/modules/src/em_code/fcon.c b/modules/src/em_code/fcon.c
new file mode 100644 (file)
index 0000000..1102e9f
--- /dev/null
@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_fcon(val, siz)
+       char *val;
+       arith siz;
+{
+       COMMA();
+       WCON(sp_fcon, val, siz);
+}
diff --git a/modules/src/em_code/icon.c b/modules/src/em_code/icon.c
new file mode 100644 (file)
index 0000000..8d06dff
--- /dev/null
@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_icon(val, siz)
+       char *val;
+       arith siz;
+{
+       COMMA();
+       WCON(sp_icon, val, siz);
+}
diff --git a/modules/src/em_code/ilb.c b/modules/src/em_code/ilb.c
new file mode 100644 (file)
index 0000000..77d4b90
--- /dev/null
@@ -0,0 +1,8 @@
+#include "em_private.h"
+
+CC_ilb(l)
+       label l;
+{
+       COMMA();
+       ILB(l);
+}
diff --git a/modules/src/em_code/msend.c b/modules/src/em_code/msend.c
new file mode 100644 (file)
index 0000000..d4d9cca
--- /dev/null
@@ -0,0 +1,7 @@
+#include "em_private.h"
+
+CC_msend()
+{
+       CEND();
+       NL();
+}
diff --git a/modules/src/em_code/msstart.c b/modules/src/em_code/msstart.c
new file mode 100644 (file)
index 0000000..9b55294
--- /dev/null
@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_msstart(cst)
+       arith cst;
+{
+       /*      start of message
+       */
+       PS(ps_mes);
+       CST(cst);
+}
diff --git a/modules/src/em_code/op.c b/modules/src/em_code/op.c
new file mode 100644 (file)
index 0000000..a9aafa3
--- /dev/null
@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_op(opcode)
+{
+       /*      Instruction that never has an argument
+               Argument types: -
+       */
+       OP(opcode);
+       NL();
+}
diff --git a/modules/src/em_code/opcst.c b/modules/src/em_code/opcst.c
new file mode 100644 (file)
index 0000000..6eba2f9
--- /dev/null
@@ -0,0 +1,12 @@
+#include "em_private.h"
+
+CC_opcst(opcode, cst)
+       arith cst;
+{
+       /*      Instruction with a constant argument
+               Argument types: c, d, l, g, f, n, s, z, o, w, r
+       */
+       OP(opcode);
+       CST(cst);
+       NL();
+}
diff --git a/modules/src/em_code/opdlb.c b/modules/src/em_code/opdlb.c
new file mode 100644 (file)
index 0000000..240f4ca
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_opdlb(opcode, dlb, offset)
+       label dlb;
+       arith offset;
+{
+       /*      Instruction that as a numeric datalabel + offset as argument
+               Argument types: g
+       */
+       OP(opcode);
+       DOFF(dlb, offset);
+       NL();
+}
diff --git a/modules/src/em_code/opdnam.c b/modules/src/em_code/opdnam.c
new file mode 100644 (file)
index 0000000..90537f1
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_opdnam(opcode, dnam, offset)
+       char *dnam;
+       arith offset;
+{
+       /*      Instruction that has a datalabel + offset as argument
+               Argument types: g
+       */
+       OP(opcode);
+       NOFF(dnam, offset);
+       NL();
+}
diff --git a/modules/src/em_code/opilb.c b/modules/src/em_code/opilb.c
new file mode 100644 (file)
index 0000000..7465583
--- /dev/null
@@ -0,0 +1,12 @@
+#include "em_private.h"
+
+CC_opilb(opcode, ilb)
+       label ilb;
+{
+       /*      Instruction with instruction label argument
+               Argument types: b
+       */
+       OP(opcode);
+       CILB(ilb);
+       NL();
+}
diff --git a/modules/src/em_code/opnarg.c b/modules/src/em_code/opnarg.c
new file mode 100644 (file)
index 0000000..c2b15a9
--- /dev/null
@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_opnarg(opcode)
+{
+       /*      Instruction with optional argument, but now without one
+               Argument types: w
+       */
+       OP(opcode);
+       CCEND();
+       NL();
+}
diff --git a/modules/src/em_code/oppnam.c b/modules/src/em_code/oppnam.c
new file mode 100644 (file)
index 0000000..e9261a0
--- /dev/null
@@ -0,0 +1,12 @@
+#include "em_private.h"
+
+CC_oppnam(opcode, pnam)
+       char *pnam;
+{
+       /*      Instruction that has a procedure name as argument
+               Argument types: p
+       */
+       OP(opcode);
+       PNAM(pnam);
+       NL();
+}
diff --git a/modules/src/em_code/pnam.c b/modules/src/em_code/pnam.c
new file mode 100644 (file)
index 0000000..bad8431
--- /dev/null
@@ -0,0 +1,8 @@
+#include "em_private.h"
+
+CC_pnam(str)
+       char *str;
+{
+       COMMA();
+       PNAM(str);
+}
diff --git a/modules/src/em_code/pro.c b/modules/src/em_code/pro.c
new file mode 100644 (file)
index 0000000..5fe987d
--- /dev/null
@@ -0,0 +1,14 @@
+#include "em_private.h"
+
+CC_pro(pnam, l)
+       char *pnam;
+       arith l;
+{
+       /*      PRO pseudo with procedure name pnam and # of locals l
+       */
+       PS(ps_pro);
+       PNAM(pnam);
+       COMMA();
+       CST(l);
+       NL();
+}
diff --git a/modules/src/em_code/pronarg.c b/modules/src/em_code/pronarg.c
new file mode 100644 (file)
index 0000000..b306752
--- /dev/null
@@ -0,0 +1,13 @@
+#include "em_private.h"
+
+CC_pronarg(pnam)
+       char *pnam;
+{
+       /*      PRO pseudo with procedure name pnam and unknown # of locals
+       */
+       PS(ps_pro);
+       PNAM(pnam);
+       COMMA();
+       CCEND();
+       NL();
+}
diff --git a/modules/src/em_code/psdlb.c b/modules/src/em_code/psdlb.c
new file mode 100644 (file)
index 0000000..611e71f
--- /dev/null
@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_psdlb(op, dlb)
+       label dlb;
+{
+       /*      Pseudo with numeric datalabel
+       */
+       PS(op);
+       DLB(dlb);
+       NL();
+}
diff --git a/modules/src/em_code/psdnam.c b/modules/src/em_code/psdnam.c
new file mode 100644 (file)
index 0000000..b92fb3f
--- /dev/null
@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_psdnam(op, dnam)
+       char *dnam;
+{
+       /*      Pseudo with data label
+       */
+       PS(op);
+       DNAM(dnam);
+       NL();
+}
diff --git a/modules/src/em_code/pspnam.c b/modules/src/em_code/pspnam.c
new file mode 100644 (file)
index 0000000..a3601fc
--- /dev/null
@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_pspnam(op, pnam)
+       char *pnam;
+{
+       /*      Pseudo with procedure name
+       */
+       PS(op);
+       PNAM(pnam);
+       NL();
+}
diff --git a/modules/src/em_code/scon.c b/modules/src/em_code/scon.c
new file mode 100644 (file)
index 0000000..8948a49
--- /dev/null
@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_scon(str, siz)
+       char *str;
+       arith siz;
+{
+       COMMA();
+       SCON(str, siz);
+}
diff --git a/modules/src/em_code/ucon.c b/modules/src/em_code/ucon.c
new file mode 100644 (file)
index 0000000..1596a04
--- /dev/null
@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_ucon(val,siz)
+       char *val;
+       arith siz;
+{
+       COMMA();
+       WCON(sp_ucon, val, siz);
+}