1988-09-12 14:30:22 +00:00
|
|
|
/* $Header$ */
|
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
|
|
|
/* makecalls: expand a datastructure as delivered by "EM_getline"
|
|
|
|
into calls to the procedural interface.
|
|
|
|
Exported routine:
|
|
|
|
C_out
|
|
|
|
*/
|
|
|
|
|
1988-09-12 14:33:15 +00:00
|
|
|
#define CODE_EXPANDER
|
1988-09-14 14:05:11 +00:00
|
|
|
#define EXPORT
|
|
|
|
#define PRIVATE static
|
1988-09-12 14:33:15 +00:00
|
|
|
|
1988-09-12 14:30:22 +00:00
|
|
|
#include <em_spec.h>
|
|
|
|
#include <em_mnem.h>
|
|
|
|
#include <em_pseu.h>
|
|
|
|
#include <em_flag.h>
|
|
|
|
#include "em_ptyp.h"
|
|
|
|
#include <em.h>
|
|
|
|
#include <em_comp.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
extern char em_flag[]; /* One per EM instruction: indicates parameter kind */
|
|
|
|
extern short em_ptyp[]; /* One per parameter kind: indicates parameter type */
|
|
|
|
static char *C_error;
|
1988-09-14 14:05:11 +00:00
|
|
|
char *C_tmpdir;
|
1988-09-12 14:30:22 +00:00
|
|
|
|
1988-10-31 15:54:54 +00:00
|
|
|
EXPORT int
|
|
|
|
C_out(p)
|
1988-09-12 14:30:22 +00:00
|
|
|
register struct e_instr *p;
|
1988-10-31 15:54:54 +00:00
|
|
|
{
|
|
|
|
C_error = 0;
|
|
|
|
switch(p->em_type) {
|
|
|
|
default:
|
|
|
|
C_error = "Illegal EM line";
|
|
|
|
break;
|
|
|
|
case EM_MNEM:
|
|
|
|
/* normal instruction */
|
1988-09-12 14:30:22 +00:00
|
|
|
{
|
|
|
|
register int parametertype; /* parametertype of the instruction */
|
|
|
|
|
|
|
|
parametertype = em_flag[p->em_opcode-sp_fmnem] & EM_PAR;
|
|
|
|
switch(parametertype) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
case PAR_W:
|
|
|
|
if (p->em_argtype != 0) {
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#include "C_mnem_narg"
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#include "C_mnem"
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case EM_DEFILB:
|
|
|
|
/* defining occurrence of an instruction label */
|
1988-10-31 15:54:54 +00:00
|
|
|
C_df_ilb(p->em_ilb);
|
1988-09-12 14:30:22 +00:00
|
|
|
break;
|
1988-09-14 14:05:11 +00:00
|
|
|
#ifdef ____
|
1988-09-12 14:30:22 +00:00
|
|
|
case EM_DEFDLB:
|
|
|
|
/* defining occurrence of a global data label */
|
1988-10-31 15:54:54 +00:00
|
|
|
C_df_dlb(p->em_dlb);
|
1988-09-12 14:30:22 +00:00
|
|
|
break;
|
|
|
|
case EM_DEFDNAM:
|
|
|
|
/* defining occurrence of a non-numeric data label */
|
1988-10-31 15:54:54 +00:00
|
|
|
C_df_dnam(p->em_dnam);
|
1988-09-12 14:30:22 +00:00
|
|
|
break;
|
|
|
|
case EM_PSEU:
|
|
|
|
/* pseudo */
|
1988-10-31 15:54:54 +00:00
|
|
|
EM_dopseudo(p);
|
1988-09-12 14:30:22 +00:00
|
|
|
break;
|
1988-09-14 14:05:11 +00:00
|
|
|
#endif
|
1988-09-12 14:30:22 +00:00
|
|
|
case EM_STARTMES:
|
|
|
|
/* start of a MES pseudo */
|
1988-10-31 15:54:54 +00:00
|
|
|
C_mes_begin((int) (p->em_cst));
|
1988-09-12 14:30:22 +00:00
|
|
|
break;
|
|
|
|
case EM_MESARG:
|
1988-10-31 15:54:54 +00:00
|
|
|
switch(p->em_argtype) {
|
|
|
|
case ilb_ptyp:
|
|
|
|
C_ilb(p->em_ilb);
|
|
|
|
break;
|
|
|
|
case nof_ptyp:
|
|
|
|
C_dlb(p->em_dlb, p->em_off);
|
|
|
|
break;
|
|
|
|
case sof_ptyp:
|
|
|
|
C_dnam(p->em_dnam, p->em_off);
|
|
|
|
break;
|
|
|
|
case cst_ptyp:
|
|
|
|
C_cst(p->em_cst);
|
|
|
|
break;
|
|
|
|
case pro_ptyp:
|
|
|
|
C_pnam(p->em_pnam);
|
|
|
|
break;
|
|
|
|
case str_ptyp:
|
|
|
|
C_scon(p->em_string, p->em_size);
|
|
|
|
break;
|
|
|
|
case ico_ptyp:
|
|
|
|
C_icon(p->em_string, p->em_size);
|
|
|
|
break;
|
|
|
|
case uco_ptyp:
|
|
|
|
C_ucon(p->em_string, p->em_size);
|
|
|
|
break;
|
|
|
|
case fco_ptyp:
|
|
|
|
C_fcon(p->em_string, p->em_size);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
C_error = "Illegal argument type";
|
1988-09-12 14:30:22 +00:00
|
|
|
break;
|
|
|
|
}
|
1988-10-31 15:54:54 +00:00
|
|
|
break;
|
|
|
|
case EM_ENDMES:
|
1988-09-12 14:30:22 +00:00
|
|
|
C_mes_end();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (C_error) return 0;
|
|
|
|
return 1;
|
|
|
|
}
|