2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 static char rcsid[] = "$Id: convert.c,v 1.11 1994/06/24 10:35:42 ceriel Exp $";
9 /* This program converts either human-readable or compact EM
10 assembly code to calls of the procedure-interface.
11 It must be linked with two libraries:
12 - a library to read EM code, according to read_em(3)
13 - a library implementing the em_code(3) interface.
14 Thus, this program could serve as an EM_encoder, an
15 EM_decoder, or some code generator, depending on how it is
28 char *filename; /* Name of input file */
29 int errors; /* Number of errors */
36 register struct e_instr *p = &buf;
42 if (!EM_open(filename)) {
46 C_init((arith) EM_wordsize, (arith) EM_pointersize);
48 if (!C_open(argv[2])) {
49 fatal("C_open failed");
52 else if (!C_open( (char *) 0)) fatal("C_open failed");
54 while (p->em_type != EM_EOF) {
55 if (p->em_type == EM_FATAL) {
56 fatal("%s", EM_error);
59 error("%s", EM_error);
61 if (p->em_type != EM_ERROR && !C_out(p)) {
77 filename ? filename : "standard input",
79 fprint(STDERR,s,a1,a2,a3,a4);
88 if (C_busy()) C_close();