From 5f6b6651e1c51560bb16a9941581d45584c1dc2c Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 6 Aug 1987 14:21:01 +0000 Subject: [PATCH] fixes --- modules/src/read_em/EM_vars.c | 4 ++-- modules/src/read_em/em_comp.h | 6 ++++-- modules/src/read_em/mkcalls.c | 32 ++++++++++++++++++-------------- modules/src/read_em/read_em.c | 1 + modules/src/read_em/reade.c | 3 ++- modules/src/read_em/readk.c | 1 + 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/modules/src/read_em/EM_vars.c b/modules/src/read_em/EM_vars.c index 678ce619e..f50dcc823 100644 --- a/modules/src/read_em/EM_vars.c +++ b/modules/src/read_em/EM_vars.c @@ -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; diff --git a/modules/src/read_em/em_comp.h b/modules/src/read_em/em_comp.h index 2178a5ebd..ef37dae06 100644 --- a/modules/src/read_em/em_comp.h +++ b/modules/src/read_em/em_comp.h @@ -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 diff --git a/modules/src/read_em/mkcalls.c b/modules/src/read_em/mkcalls.c index 2e6fc5c95..016b32ab7 100644 --- a/modules/src/read_em/mkcalls.c +++ b/modules/src/read_em/mkcalls.c @@ -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; } diff --git a/modules/src/read_em/read_em.c b/modules/src/read_em/read_em.c index 8eed3437d..ec7f91667 100644 --- a/modules/src/read_em/read_em.c +++ b/modules/src/read_em/read_em.c @@ -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"; diff --git a/modules/src/read_em/reade.c b/modules/src/read_em/reade.c index 144c47203..300fdfd7d 100644 --- a/modules/src/read_em/reade.c +++ b/modules/src/read_em/reade.c @@ -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*/ } diff --git a/modules/src/read_em/readk.c b/modules/src/read_em/readk.c index df4e813ed..a44c66d0f 100644 --- a/modules/src/read_em/readk.c +++ b/modules/src/read_em/readk.c @@ -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 */