This commit is contained in:
ceriel 1987-08-06 14:21:01 +00:00
parent 912e362f11
commit 5f6b6651e1
6 changed files with 28 additions and 19 deletions

View file

@ -12,5 +12,5 @@ char *EM_error;
char *EM_filename;
unsigned int EM_lineno;
int EM_wordsize, EM_pointersize;
arith EM_holsize, EM_bsssize;
int EM_holinit, EM_bssinit;
arith EM_holsize;
int EM_holinit;

View file

@ -43,9 +43,11 @@ struct e_instr {
};
extern arith
EM_holsize, EM_bsssize;
EM_holsize;
#define EM_bsssize EM_holsize
extern int
EM_holinit, EM_bssinit;
EM_holinit;
#define EM_bssinit EM_holinit
#define em_ilb em_arg.ema_ilb
#define em_dlb em_arg.ema_dlb

View file

@ -44,16 +44,18 @@ checkarg(arg, typset)
an argument expected, but there is none
*/
EM_error = "Illegal number of parameters";
return;
return 0;
}
if (!(arg->ema_argtype & typset)) {
/* Type error */
EM_error = "Illegal parameter type";
return 0;
}
return 1;
}
#else not CHECKING
#define checkarg(arg, x)
#define checkarg(arg, x) 1
#endif CHECKING
/* EM_doinstr: An EM instruction
@ -77,11 +79,13 @@ EM_doinstr(p)
case PAR_NO:
break;
default:
checkarg(&(p->em_arg), em_ptyp[parametertype]);
if (! checkarg(&(p->em_arg), em_ptyp[parametertype])) {
return;
}
break;
case PAR_W:
if (p->em_argtype != 0) {
checkarg(&(p->em_arg), cst_ptyp);
if (! checkarg(&(p->em_arg), cst_ptyp)) return;
}
else {
#include "C_mnem_narg"
@ -103,7 +107,7 @@ EM_dopseudo(p)
break;
}
case ps_hol: {
checkarg(&(p->em_arg), par_ptyp);
if (! checkarg(&(p->em_arg), par_ptyp)) break;
switch(p->em_argtype) {
case cst_ptyp:
C_hol_cst(EM_holsize,
@ -157,7 +161,7 @@ EM_dopseudo(p)
break;
}
case ps_bss: {
checkarg(&(p->em_arg), par_ptyp);
if (! checkarg(&(p->em_arg), par_ptyp)) break;
switch(p->em_argtype) {
case cst_ptyp:
C_bss_cst(EM_bsssize,
@ -212,7 +216,7 @@ EM_dopseudo(p)
}
case ps_end:
if (p->em_argtype != 0) {
checkarg(&(p->em_arg), cst_ptyp);
if (! checkarg(&(p->em_arg), cst_ptyp)) break;
C_end(p->em_cst);
break;
}
@ -220,7 +224,7 @@ EM_dopseudo(p)
break;
case ps_exa:
case ps_ina:
checkarg(&(p->em_arg), lab_ptyp);
if (! checkarg(&(p->em_arg), lab_ptyp)) break;
if (p->em_argtype == nof_ptyp) {
if (p->em_opcode == ps_exa) {
C_exa_dlb(p->em_dlb);
@ -234,22 +238,22 @@ EM_dopseudo(p)
else C_ina_dnam(p->em_dnam);
break;
case ps_exp:
checkarg(&(p->em_arg), pro_ptyp);
if (! checkarg(&(p->em_arg), pro_ptyp)) break;
C_exp(p->em_pnam);
break;
case ps_inp:
checkarg(&(p->em_arg), pro_ptyp);
if (! checkarg(&(p->em_arg), pro_ptyp)) break;
C_inp(p->em_pnam);
break;
case ps_pro:
checkarg(&(p->em_arg), pro_ptyp);
if (! checkarg(&(p->em_arg), pro_ptyp)) break;
if (p->em_nlocals >= 0) {
C_pro(p->em_pnam, p->em_nlocals);
}
else C_pro_narg(p->em_pnam);
break;
case ps_con:
checkarg(&(p->em_arg), val_ptyp);
if (! checkarg(&(p->em_arg), val_ptyp)) break;
switch(p->em_argtype) {
case ilb_ptyp:
C_con_ilb(p->em_ilb);
@ -284,7 +288,7 @@ EM_dopseudo(p)
}
break;
case ps_rom:
checkarg(&(p->em_arg), val_ptyp);
if (! checkarg(&(p->em_arg), val_ptyp)) break;
switch(p->em_argtype) {
case ilb_ptyp:
C_rom_ilb(p->em_ilb);
@ -372,7 +376,7 @@ EM_dostartmes(p)
EM_error = "Message not ended";
return;
}
checkarg(&(p->em_arg), cst_ptyp);
if (! checkarg(&(p->em_arg), cst_ptyp)) return;
C_mes_begin((int) (p->em_cst));
listtype = ps_mes;
}

View file

@ -221,6 +221,7 @@ EM_getinstr(p)
return 1;
}
emhead = p;
p->em_type = 0;
#ifdef CHECKING
if (!EM_initialized) {
EM_error = "Initialization not done";

View file

@ -616,7 +616,7 @@ getlabel(c, p)
PRIVATE
gethead(p)
struct e_instr *p;
register struct e_instr *p;
{
register int c;
@ -647,6 +647,7 @@ gethead(p)
return;
}
checkeol();
if (p->em_type == EM_ERROR || p->em_type == EM_FATAL) return;
}
/*NOTREACHED*/
}

View file

@ -50,6 +50,7 @@ getarg(typset, ap)
int argtyp;
#endif CHECKING
ap->ema_argtype = 0;
switch(i) {
default:
if (i < sp_fcst0+sp_ncst0 && i >= sp_fcst0) { /* A cst */