Browse Source

completely new version

ceriel 37 years ago
parent
commit
1e1578a5c1
52 changed files with 975 additions and 116 deletions
  1. 53 5
      modules/src/em_code/.distr
  2. 173 0
      modules/src/em_code/C_out.c
  3. 23 16
      modules/src/em_code/Makefile
  4. 17 0
      modules/src/em_code/bhcst.c
  5. 19 0
      modules/src/em_code/bhdlb.c
  6. 19 0
      modules/src/em_code/bhdnam.c
  7. 19 0
      modules/src/em_code/bhfcon.c
  8. 19 0
      modules/src/em_code/bhicon.c
  9. 18 0
      modules/src/em_code/bhilb.c
  10. 18 0
      modules/src/em_code/bhpnam.c
  11. 19 0
      modules/src/em_code/bhucon.c
  12. 89 0
      modules/src/em_code/convert.c
  13. 12 0
      modules/src/em_code/crcst.c
  14. 13 0
      modules/src/em_code/crdlb.c
  15. 13 0
      modules/src/em_code/crdnam.c
  16. 13 0
      modules/src/em_code/crfcon.c
  17. 13 0
      modules/src/em_code/cricon.c
  18. 12 0
      modules/src/em_code/crilb.c
  19. 12 0
      modules/src/em_code/crpnam.c
  20. 13 0
      modules/src/em_code/crscon.c
  21. 13 0
      modules/src/em_code/crucon.c
  22. 8 0
      modules/src/em_code/cst.c
  23. 10 0
      modules/src/em_code/dfdlb.c
  24. 10 0
      modules/src/em_code/dfdnam.c
  25. 10 0
      modules/src/em_code/dfilb.c
  26. 9 0
      modules/src/em_code/dlb.c
  27. 9 0
      modules/src/em_code/dnam.c
  28. 72 95
      modules/src/em_code/em.nogen
  29. 3 0
      modules/src/em_code/em_code.3X
  30. 11 0
      modules/src/em_code/end.c
  31. 10 0
      modules/src/em_code/endarg.c
  32. 11 0
      modules/src/em_code/exc.c
  33. 9 0
      modules/src/em_code/fcon.c
  34. 9 0
      modules/src/em_code/icon.c
  35. 8 0
      modules/src/em_code/ilb.c
  36. 7 0
      modules/src/em_code/msend.c
  37. 10 0
      modules/src/em_code/msstart.c
  38. 10 0
      modules/src/em_code/op.c
  39. 12 0
      modules/src/em_code/opcst.c
  40. 13 0
      modules/src/em_code/opdlb.c
  41. 13 0
      modules/src/em_code/opdnam.c
  42. 12 0
      modules/src/em_code/opilb.c
  43. 11 0
      modules/src/em_code/opnarg.c
  44. 12 0
      modules/src/em_code/oppnam.c
  45. 8 0
      modules/src/em_code/pnam.c
  46. 14 0
      modules/src/em_code/pro.c
  47. 13 0
      modules/src/em_code/pronarg.c
  48. 11 0
      modules/src/em_code/psdlb.c
  49. 11 0
      modules/src/em_code/psdnam.c
  50. 11 0
      modules/src/em_code/pspnam.c
  51. 9 0
      modules/src/em_code/scon.c
  52. 9 0
      modules/src/em_code/ucon.c

+ 53 - 5
modules/src/em_code/.distr

@@ -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

+ 173 - 0
modules/src/em_code/C_out.c

@@ -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();
+}

+ 23 - 16
modules/src/em_code/Makefile

@@ -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

+ 17 - 0
modules/src/em_code/bhcst.c

@@ -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();
+}

+ 19 - 0
modules/src/em_code/bhdlb.c

@@ -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();
+}

+ 19 - 0
modules/src/em_code/bhdnam.c

@@ -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();
+}

+ 19 - 0
modules/src/em_code/bhfcon.c

@@ -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();
+}

+ 19 - 0
modules/src/em_code/bhicon.c

@@ -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();
+}

+ 18 - 0
modules/src/em_code/bhilb.c

@@ -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();
+}

+ 18 - 0
modules/src/em_code/bhpnam.c

@@ -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();
+}

+ 19 - 0
modules/src/em_code/bhucon.c

@@ -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();
+}

+ 89 - 0
modules/src/em_code/convert.c

@@ -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);
+}

+ 12 - 0
modules/src/em_code/crcst.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/crdlb.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/crdnam.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/crfcon.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/cricon.c

@@ -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();
+}

+ 12 - 0
modules/src/em_code/crilb.c

@@ -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();
+}

+ 12 - 0
modules/src/em_code/crpnam.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/crscon.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/crucon.c

@@ -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();
+}

+ 8 - 0
modules/src/em_code/cst.c

@@ -0,0 +1,8 @@
+#include "em_private.h"
+
+CC_cst(l)
+	arith l;
+{
+	COMMA();
+	CST(l);
+}

+ 10 - 0
modules/src/em_code/dfdlb.c

@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_dfdlb(l)
+	label l;
+{
+	/*	Define numeric data label
+	*/
+	DFDLB(l);
+	NL();
+}

+ 10 - 0
modules/src/em_code/dfdnam.c

@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_dfdnam(s)
+	char *s;
+{
+	/*	Define data label
+	*/
+	DFDNAM(s);
+	NL();
+}

+ 10 - 0
modules/src/em_code/dfilb.c

@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_dfilb(l)
+	label l;
+{
+	/*	Define instruction label
+	*/
+	DFILB(l);
+	NL();
+}

+ 9 - 0
modules/src/em_code/dlb.c

@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_dlb(l, val)
+	label l;
+	arith val;
+{
+	COMMA();
+	DOFF(l, val);
+}

+ 9 - 0
modules/src/em_code/dnam.c

@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_dnam(str, val)
+	char *str;
+	arith val;
+{
+	COMMA();
+	NOFF(str, val);
+}

+ 72 - 95
modules/src/em_code/em.nogen

@@ -1,106 +1,83 @@
-% 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

+ 3 - 0
modules/src/em_code/em_code.3X

@@ -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 ()

+ 11 - 0
modules/src/em_code/end.c

@@ -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();
+}

+ 10 - 0
modules/src/em_code/endarg.c

@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_endnarg()
+{
+	/*	END pseudo of procedure with unknown # of locals
+	*/
+	PS(ps_end);
+	CCEND();
+	NL();
+}

+ 11 - 0
modules/src/em_code/exc.c

@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_exc(c1,c2)
+	arith c1,c2;
+{
+	PS(ps_exc);
+	CST(c1);
+	COMMA();
+	CST(c2);
+	NL();
+}

+ 9 - 0
modules/src/em_code/fcon.c

@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_fcon(val, siz)
+	char *val;
+	arith siz;
+{
+	COMMA();
+	WCON(sp_fcon, val, siz);
+}

+ 9 - 0
modules/src/em_code/icon.c

@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_icon(val, siz)
+	char *val;
+	arith siz;
+{
+	COMMA();
+	WCON(sp_icon, val, siz);
+}

+ 8 - 0
modules/src/em_code/ilb.c

@@ -0,0 +1,8 @@
+#include "em_private.h"
+
+CC_ilb(l)
+	label l;
+{
+	COMMA();
+	ILB(l);
+}

+ 7 - 0
modules/src/em_code/msend.c

@@ -0,0 +1,7 @@
+#include "em_private.h"
+
+CC_msend()
+{
+	CEND();
+	NL();
+}

+ 10 - 0
modules/src/em_code/msstart.c

@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_msstart(cst)
+	arith cst;
+{
+	/*	start of message
+	*/
+	PS(ps_mes);
+	CST(cst);
+}

+ 10 - 0
modules/src/em_code/op.c

@@ -0,0 +1,10 @@
+#include "em_private.h"
+
+CC_op(opcode)
+{
+	/*	Instruction that never has an argument
+		Argument types: -
+	*/
+	OP(opcode);
+	NL();
+}

+ 12 - 0
modules/src/em_code/opcst.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/opdlb.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/opdnam.c

@@ -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();
+}

+ 12 - 0
modules/src/em_code/opilb.c

@@ -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();
+}

+ 11 - 0
modules/src/em_code/opnarg.c

@@ -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();
+}

+ 12 - 0
modules/src/em_code/oppnam.c

@@ -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();
+}

+ 8 - 0
modules/src/em_code/pnam.c

@@ -0,0 +1,8 @@
+#include "em_private.h"
+
+CC_pnam(str)
+	char *str;
+{
+	COMMA();
+	PNAM(str);
+}

+ 14 - 0
modules/src/em_code/pro.c

@@ -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();
+}

+ 13 - 0
modules/src/em_code/pronarg.c

@@ -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();
+}

+ 11 - 0
modules/src/em_code/psdlb.c

@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_psdlb(op, dlb)
+	label dlb;
+{
+	/*	Pseudo with numeric datalabel
+	*/
+	PS(op);
+	DLB(dlb);
+	NL();
+}

+ 11 - 0
modules/src/em_code/psdnam.c

@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_psdnam(op, dnam)
+	char *dnam;
+{
+	/*	Pseudo with data label
+	*/
+	PS(op);
+	DNAM(dnam);
+	NL();
+}

+ 11 - 0
modules/src/em_code/pspnam.c

@@ -0,0 +1,11 @@
+#include "em_private.h"
+
+CC_pspnam(op, pnam)
+	char *pnam;
+{
+	/*	Pseudo with procedure name
+	*/
+	PS(op);
+	PNAM(pnam);
+	NL();
+}

+ 9 - 0
modules/src/em_code/scon.c

@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_scon(str, siz)
+	char *str;
+	arith siz;
+{
+	COMMA();
+	SCON(str, siz);
+}

+ 9 - 0
modules/src/em_code/ucon.c

@@ -0,0 +1,9 @@
+#include "em_private.h"
+
+CC_ucon(val,siz)
+	char *val;
+	arith siz;
+{
+	COMMA();
+	WCON(sp_ucon, val, siz);
+}