#include <em.h>
#include <em_mes.h>
+void
C_ms_com(str)
char *str;
{
#include <em.h>
#include <em_mes.h>
+void
C_ms_ego(hint, offs, siz, regno)
int hint, regno;
arith offs, siz;
#include <em.h>
#include <em_mes.h>
+void
C_ms_emx(wsiz, psiz)
arith wsiz, psiz;
{
#include <em.h>
#include <em_mes.h>
+void
C_ms_err()
{
C_mes_begin(ms_err);
#include <em.h>
#include <em_mes.h>
+void
C_ms_flt()
{
C_mes_begin(ms_flt);
#include <em.h>
#include <em_mes.h>
+void
C_ms_gto()
{
C_mes_begin(ms_gto);
#include <em.h>
#include <em_mes.h>
+void
C_ms_opt()
{
C_mes_begin(ms_opt);
#include <em.h>
#include <em_mes.h>
+void
C_ms_par(nparams)
arith nparams;
{
#include <em.h>
#include <em_mes.h>
+void
C_ms_reg(offs, siz, class, prior)
arith offs, siz;
int class, prior;
#include <em.h>
#include <em_mes.h>
+void
C_ms_src(nlines, filnam)
int nlines;
char *filnam;
#include <em.h>
#include <em_mes.h>
+void
C_ms_stb_cst(s, e1, e2, e3)
char *s;
int e1, e2;
C_mes_end();
}
+void
C_ms_stb_dlb(s, e1, e2, l, off)
char *s;
int e1, e2;
C_mes_end();
}
+void
C_ms_stb_dnam(s, e1, e2, l, off)
char *s;
int e1, e2;
C_mes_end();
}
+void
C_ms_stb_ilb(s, e1, e2, l)
char *s;
int e1, e2;
C_mes_end();
}
+void
C_ms_stb_pnam(s, e1, e2, p)
char *s;
int e1, e2;
#include <em.h>
#include <em_mes.h>
+void
C_ms_std(s, e1, l)
char *s;
int e1;
.nf
.B #include <em.h>
.PP
-.B C_ms_err()
+.B void C_ms_err()
.PP
-.B C_ms_opt()
+.B void C_ms_opt()
.PP
-.B C_ms_emx(wsiz, psiz)
+.B void C_ms_emx(wsiz, psiz)
.B arith wsiz, psiz;
.PP
.B #include <em_reg.h>
-.B C_ms_reg(offs, siz, class, prior)
+.B void C_ms_reg(offs, siz, class, prior)
.B arith offs, siz;
.B int class, prior;
.PP
-.B C_ms_src(nlines, filnam)
+.B void C_ms_src(nlines, filnam)
.B int nlines;
.B char *filnam;
.PP
-.B C_ms_flt()
+.B void C_ms_flt()
.PP
-.B C_ms_com(str)
+.B void C_ms_com(str)
.B char *str;
.PP
-.B C_ms_par(nparams)
+.B void C_ms_par(nparams)
.B arith nparams;
.PP
.B #include <em_ego.h>
-.B C_ms_ego(hint, offs, siz, regno)
+.B void C_ms_ego(hint, offs, siz, regno)
.B int hint, regno;
.B arith offs, siz;
.PP
-.B C_ms_gto()
+.B void C_ms_gto()
.PP
-.B C_ms_stb_cst(s, e1, e2, e3)
+.B void C_ms_stb_cst(s, e1, e2, e3)
.B char *s;
.B int e1, e2;
.B arith e3;
.PP
-.B C_ms_stb_dlb(s, e1, e2, l, off)
+.B void C_ms_stb_dlb(s, e1, e2, l, off)
.B char *s;
.B int e1, e2;
.B label l;
.B arith off;
.PP
-.B C_ms_stb_dnam(s, e1, e2, l, off)
+.B void C_ms_stb_dnam(s, e1, e2, l, off)
.B char *s;
.B int e1, e2;
.B char *l;
.B arith off;
.PP
-.B C_ms_stb_ilb(s, e1, e2, l)
+.B void C_ms_stb_ilb(s, e1, e2, l)
.B char *s;
.B int e1, e2;
.B label l;
.PP
-.B C_ms_stb_pnam(s, e1, e2, p)
+.B void C_ms_stb_pnam(s, e1, e2, p)
.B char *s;
.B int e1, e2;
.B char *p;
.PP
-.B C_ms_lin(l)
+.B void C_ms_std(s, e1, l)
+.B char *s;
+.B int e1;
.B int l;
.fi
.SH DESCRIPTION
The
.B C_ms_stb
and
-.B C_ms_lin
+.B C_ms_std
routines produce a message that a back-end can use for (debugger) symbol table
entries.
.SH FILES
em_code(3), read_em(3)
.SH DIAGNOSTICS
None of the functions return a value.
-.SH BUGS
-The
+.SH REMARKS
+There is no
.BR C_ms_ext ()
-routine has not yet been implemented, since this message uses
-a variable number of arguments.
+routine, since this message uses a variable number of arguments.
rm -f *.$(SUF)
install: all
+ -mkdir $(MOD_DIR)/lib
cp libem_mes.$(LIBSUF) $(MOD_DIR)/lib/libem_mes.$(LIBSUF)
cp libem_mesCE.$(LIBSUF) $(MOD_DIR)/lib/libem_mesCE.$(LIBSUF)
cp libem_mesO.$(LIBSUF) $(MOD_DIR)/lib/libem_mesO.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libem_mes.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libem_mesCE.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libem_mesO.$(LIBSUF)
- cp $(SRC_DIR)/em_mes.3 $(MOD_DIR)/man/em_mes.3
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/em_mes.3 $(TARGET_HOME) ; \
fi
-cmp libem_mes.$(LIBSUF) $(MOD_DIR)/lib/libem_mes.$(LIBSUF)
-cmp libem_mesCE.$(LIBSUF) $(MOD_DIR)/lib/libem_mesCE.$(LIBSUF)
-cmp libem_mesO.$(LIBSUF) $(MOD_DIR)/lib/libem_mesO.$(LIBSUF)
- -cmp $(SRC_DIR)/em_mes.3 $(MOD_DIR)/man/em_mes.3
pr:
@pr $(SRC_DIR)/proto.make $(SRC)
patterns
pseudo.r
syntax.l
+em_codeO.h
return(((w<<amount)&highmask) | ((w >> (8*OO_WSIZE-amount))&lowmask));
}
+int
OO_signsame(a,b)
arith a, b;
{
return( (a ^ b) >= 0);
}
+int
OO_sfit(val,nbits)
arith val, nbits;
{
return(((val&mask) == 0) | (val&mask)==mask);
}
+int
OO_ufit(val, nbits)
arith val, nbits;
{
return((val&(~((1L << (nbits - 1)) - 1))) == 0);
}
+int
OO_extsame(a1,a2)
register p_instr a1, a2;
{
}
}
+int
OO_namsame(a1,a2)
register p_instr a1, a2;
{
--- /dev/null
+#define C_insertpart O_insertpart
+#define C_beginpart O_beginpart
+#define C_endpart O_endpart
+#define C_aar O_aar
+#define C_aar_narg O_aar_narg
+#define C_adf O_adf
+#define C_adf_narg O_adf_narg
+#define C_adi O_adi
+#define C_adi_narg O_adi_narg
+#define C_adp O_adp
+#define C_ads O_ads
+#define C_ads_narg O_ads_narg
+#define C_adu O_adu
+#define C_adu_narg O_adu_narg
+#define C_and O_and
+#define C_and_narg O_and_narg
+#define C_asp O_asp
+#define C_ass O_ass
+#define C_ass_narg O_ass_narg
+#define C_beq O_beq
+#define C_bge O_bge
+#define C_bgt O_bgt
+#define C_ble O_ble
+#define C_blm O_blm
+#define C_bls O_bls
+#define C_bls_narg O_bls_narg
+#define C_blt O_blt
+#define C_bne O_bne
+#define C_bra O_bra
+#define C_bss_cst O_bss_cst
+#define C_bss_fcon O_bss_fcon
+#define C_bss_pnam O_bss_pnam
+#define C_bss_ucon O_bss_ucon
+#define C_cai O_cai
+#define C_cal O_cal
+#define C_cff O_cff
+#define C_cfi O_cfi
+#define C_cfu O_cfu
+#define C_cif O_cif
+#define C_cii O_cii
+#define C_ciu O_ciu
+#define C_close O_close
+#define C_cmf O_cmf
+#define C_cmf_narg O_cmf_narg
+#define C_cmi O_cmi
+#define C_cmi_narg O_cmi_narg
+#define C_cmp O_cmp
+#define C_cms O_cms
+#define C_cms_narg O_cms_narg
+#define C_cmu O_cmu
+#define C_cmu_narg O_cmu_narg
+#define C_com O_com
+#define C_com_narg O_com_narg
+#define C_con_cst O_con_cst
+#define C_con_fcon O_con_fcon
+#define C_con_pnam O_con_pnam
+#define C_con_scon O_con_scon
+#define C_con_ucon O_con_ucon
+#define C_csa O_csa
+#define C_csa_narg O_csa_narg
+#define C_csb O_csb
+#define C_csb_narg O_csb_narg
+#define C_cst O_cst
+#define C_cuf O_cuf
+#define C_cui O_cui
+#define C_cuu O_cuu
+#define C_dch O_dch
+#define C_dec O_dec
+#define C_dee O_dee
+#define C_del O_del
+#define C_df_dlb O_df_dlb
+#define C_df_dnam O_df_dnam
+#define C_df_ilb O_df_ilb
+#define C_dlb O_dlb
+#define C_dnam O_dnam
+#define C_dup O_dup
+#define C_dus O_dus
+#define C_dus_narg O_dus_narg
+#define C_dvf O_dvf
+#define C_dvf_narg O_dvf_narg
+#define C_dvi O_dvi
+#define C_dvi_narg O_dvi_narg
+#define C_dvu O_dvu
+#define C_dvu_narg O_dvu_narg
+#define C_end O_end
+#define C_end_narg O_end_narg
+#define C_exc O_exc
+#define C_exg O_exg
+#define C_exg_narg O_exg_narg
+#define C_exp O_exp
+#define C_fcon O_fcon
+#define C_fef O_fef
+#define C_fef_narg O_fef_narg
+#define C_fif O_fif
+#define C_fif_narg O_fif_narg
+#define C_fil O_fil
+#define C_gto O_gto
+#define C_hol_cst O_hol_cst
+#define C_hol_fcon O_hol_fcon
+#define C_hol_pnam O_hol_pnam
+#define C_hol_ucon O_hol_ucon
+#define C_icon O_icon
+#define C_ilb O_ilb
+#define C_inc O_inc
+#define C_ine O_ine
+#define C_init O_init
+#define C_inl O_inl
+#define C_inn O_inn
+#define C_inn_narg O_inn_narg
+#define C_inp O_inp
+#define C_ior O_ior
+#define C_ior_narg O_ior_narg
+#define C_lae O_lae
+#define C_lal O_lal
+#define C_lar O_lar
+#define C_lar_narg O_lar_narg
+#define C_ldc O_ldc
+#define C_lde O_lde
+#define C_ldf O_ldf
+#define C_ldl O_ldl
+#define C_lfr O_lfr
+#define C_lil O_lil
+#define C_lim O_lim
+#define C_lin O_lin
+#define C_lni O_lni
+#define C_loc O_loc
+#define C_loe O_loe
+#define C_lof O_lof
+#define C_loi O_loi
+#define C_lol O_lol
+#define C_lor O_lor
+#define C_los O_los
+#define C_los_narg O_los_narg
+#define C_lpb O_lpb
+#define C_lpi O_lpi
+#define C_lxa O_lxa
+#define C_lxl O_lxl
+#define C_magic O_magic
+#define C_mes_begin O_mes_begin
+#define C_mes_end O_mes_end
+#define C_mlf O_mlf
+#define C_mlf_narg O_mlf_narg
+#define C_mli O_mli
+#define C_mli_narg O_mli_narg
+#define C_mlu O_mlu
+#define C_mlu_narg O_mlu_narg
+#define C_mon O_mon
+#define C_ngf O_ngf
+#define C_ngf_narg O_ngf_narg
+#define C_ngi O_ngi
+#define C_ngi_narg O_ngi_narg
+#define C_nop O_nop
+#define C_open O_open
+#define C_pnam O_pnam
+#define C_pro O_pro
+#define C_pro_narg O_pro_narg
+#define C_rck O_rck
+#define C_rck_narg O_rck_narg
+#define C_ret O_ret
+#define C_rmi O_rmi
+#define C_rmi_narg O_rmi_narg
+#define C_rmu O_rmu
+#define C_rmu_narg O_rmu_narg
+#define C_rol O_rol
+#define C_rol_narg O_rol_narg
+#define C_rom_cst O_rom_cst
+#define C_rom_fcon O_rom_fcon
+#define C_rom_pnam O_rom_pnam
+#define C_rom_scon O_rom_scon
+#define C_rom_ucon O_rom_ucon
+#define C_ror O_ror
+#define C_ror_narg O_ror_narg
+#define C_rtt O_rtt
+#define C_sar O_sar
+#define C_sar_narg O_sar_narg
+#define C_sbf O_sbf
+#define C_sbf_narg O_sbf_narg
+#define C_sbi O_sbi
+#define C_sbi_narg O_sbi_narg
+#define C_sbs O_sbs
+#define C_sbs_narg O_sbs_narg
+#define C_sbu O_sbu
+#define C_sbu_narg O_sbu_narg
+#define C_scon O_scon
+#define C_sde O_sde
+#define C_sdf O_sdf
+#define C_sdl O_sdl
+#define C_set O_set
+#define C_set_narg O_set_narg
+#define C_sig O_sig
+#define C_sil O_sil
+#define C_sim O_sim
+#define C_sli O_sli
+#define C_sli_narg O_sli_narg
+#define C_slu O_slu
+#define C_slu_narg O_slu_narg
+#define C_sri O_sri
+#define C_sri_narg O_sri_narg
+#define C_sru O_sru
+#define C_sru_narg O_sru_narg
+#define C_ste O_ste
+#define C_stf O_stf
+#define C_sti O_sti
+#define C_stl O_stl
+#define C_str O_str
+#define C_sts O_sts
+#define C_sts_narg O_sts_narg
+#define C_teq O_teq
+#define C_tge O_tge
+#define C_tgt O_tgt
+#define C_tle O_tle
+#define C_tlt O_tlt
+#define C_tne O_tne
+#define C_trp O_trp
+#define C_ucon O_ucon
+#define C_xor O_xor
+#define C_xor_narg O_xor_narg
+#define C_zeq O_zeq
+#define C_zer O_zer
+#define C_zer_narg O_zer_narg
+#define C_zge O_zge
+#define C_zgt O_zgt
+#define C_zle O_zle
+#define C_zlt O_zlt
+#define C_zne O_zne
+#define C_zre O_zre
+#define C_zrf O_zrf
+#define C_zrf_narg O_zrf_narg
+#define C_zrl O_zrl
+
+#define C_hol_ilb O_hol_ilb
+#define C_bss_dnam O_bss_dnam
+#define C_bss_dlb O_bss_dlb
+#define C_bss_icon O_bss_icon
+#define C_bss_ilb O_bss_ilb
+#define C_con_dnam O_con_dnam
+#define C_con_dlb O_con_dlb
+#define C_con_icon O_con_icon
+#define C_con_ilb O_con_ilb
+#define C_gto_dnam O_gto_dnam
+#define C_lae_dnam O_lae_dnam
+#define C_gto_dlb O_gto_dlb
+#define C_ine_dnam O_ine_dnam
+#define C_ine_dlb O_ine_dlb
+#define C_rom_dnam O_rom_dnam
+#define C_rom_dlb O_rom_dlb
+#define C_ina_dnam O_ina_dnam
+#define C_ina_dlb O_ina_dlb
+#define C_rom_icon O_rom_icon
+#define C_rom_ilb O_rom_ilb
+#define C_ste_dnam O_ste_dnam
+#define C_lae_dlb O_lae_dlb
+#define C_ste_dlb O_ste_dlb
+#define C_fil_dnam O_fil_dnam
+#define C_fil_dlb O_fil_dlb
+#define C_lde_dnam O_lde_dnam
+#define C_lde_dlb O_lde_dlb
+#define C_loe_dnam O_loe_dnam
+#define C_loe_dlb O_loe_dlb
+#define C_exa_dnam O_exa_dnam
+#define C_exa_dlb O_exa_dlb
+#define C_dee_dnam O_dee_dnam
+#define C_sde_dnam O_sde_dnam
+#define C_dee_dlb O_dee_dlb
+#define C_sde_dlb O_sde_dlb
+#define C_zre_dnam O_zre_dnam
+#define C_zre_dlb O_zre_dlb
+#define C_hol_dnam O_hol_dnam
+#define C_hol_dlb O_hol_dlb
+#define C_hol_icon O_hol_icon
.B #define PEEPHOLE
.B #include <em.h>
.PP
-.B O_init(wsize, psize)
+.B void O_init(wsize, psize)
.B arith wsize, psize;
.PP
.B int O_open(filename)
-.B O_close()
+.B void O_close()
.B int O_busy()
.B char *filename;
.PP
-.B O_magic()
+.B void O_magic()
.PP
-.B O_df_dlb(l)
-.B O_df_dnam(s)
-.B O_df_ilb(l)
+.B void O_df_dlb(l)
+.B void O_df_dnam(s)
+.B void O_df_ilb(l)
.B label l; char *s;
.PP
-.B O_pro(s, l)
-.B O_pro_narg(s)
-.B O_end(l)
-.B O_end_narg()
+.B void O_pro(s, l)
+.B void O_pro_narg(s)
+.B void O_end(l)
+.B void O_end_narg()
.B char *s; arith l;
.PP
-.B O_exa_dlb(l)
-.B O_exa_dnam(s)
-.B O_exp(s)
-.B O_ina_dlb(l)
-.B O_ina_dnam(s)
-.B O_inp(s)
+.B void O_exa_dlb(l)
+.B void O_exa_dnam(s)
+.B void O_exp(s)
+.B void O_ina_dlb(l)
+.B void O_ina_dnam(s)
+.B void O_inp(s)
.B char *s; label l;
.PP
-.BI O_bss_ cstp ()
-.BI O_hol_ cstp ()
-.BI O_con_ cstp ()
-.BI O_rom_ cstp ()
+.BI "void O_bss_" cstp ()
+.BI "void O_hol_" cstp ()
+.BI "void O_con_" cstp ()
+.BI "void O_rom_" cstp ()
.PP
.B #include <em_mes.h>
-.B O_mes_begin(ms)
-.BI O_ cstp ()
-.B O_mes_end()
+.B void O_mes_begin(ms)
+.BI "void O_" cstp ()
+.B void O_mes_end()
.B int ms;
.PP
-.B O_exc(c1, c2)
+.B void O_exc(c1, c2)
.B arith c1, c2;
.PP
-.BI O_ mnem ()
-.BI O_ mnem _dlb()
-.BI O_ mnem _dnam()
-.BI O_ mnem _narg()
+.BI "void O_" mnem ()
+.BI "void O_" mnem _dlb()
+.BI "void O_" mnem _dnam()
+.BI "void O_" mnem _narg()
.PP
-.B O_insertpart(id)
+.B void O_insertpart(id)
.B int id;
.PP
-.B O_beginpart(id)
+.B void O_beginpart(id)
.B int id;
.PP
-.B O_endpart(id)
+.B void O_endpart(id)
.B int id;
.fi
.SH DESCRIPTION
#define UPDATEWORST(backups) if(backups>mostbackups) mostbackups = backups;
+PRIVATE int leftmatch();
+PRIVATE int rightmatch();
+
findworst(patt,repl)
struct mnems patt,repl;
{
extern char em_flag[];
extern char em_mnem[][4];
+PRIVATE idinit();
+
initlex()
{
register int i,j;
FS = "|";
seenproc = 0;
CC="${CMD}"
+ if (prototypes == "") prototypes = "prototypes"
}
/^%/ {}
/^$/ {}
nam = $1
printf "cat > O_%s.c << '--EOF--'\n",$1
print "#include \"nopt.h\""
- printf "O_%s(",$1
+ printf "void O_%s(",$1
+ prototype = "_PROTOTYPE(void O_" $1 ", ("
nparms = split($2,parms,":");
for(p=1;p<nparms;p++) {
if(p!=1) {
printf a[1]
}
printf ")\n"
- if(nparms) {
+ if(nparms > 1) {
+ prototype = prototype parms[1]
printf "\t%s",parms[1]
}
+ else {
+ prototype = prototype "void"
+ }
for(p=1;p<nparms;p++) {
split(parms[p+1],a," ")
+ prototype = prototype " " a[1]
printf " %s;\n",a[1]
if(a[2]) {
+ prototype = prototype ", " a[2] a[3] a[4]
printf "\t%s%s%s",a[2],a[3],a[4]
}
}
+ print prototype "));" >> prototypes
if($3) {
printf "{\n\t%s\n",$3
}
#include "nopt.h"
+void
EM_mkop(p,opcode)
register p_instr p;
int opcode;
p->em_argtype = 0;
}
+void
EM_mknarg(p,opcode)
register p_instr p;
int opcode;
p->em_cst = 0;
}
+void
EM_mkilb(p,opcode,lab)
register p_instr p;
int opcode;
p->em_ilb = lab;
}
+void
EM_mknof(p,opcode,lab,off)
register p_instr p;
int opcode;
p->em_off = off;
}
+void
EM_mksof(p,opcode,name,off)
register p_instr p;
int opcode;
p->em_off = off;
}
+void
EM_mkcst(p,opcode,cst)
register p_instr p;
int opcode;
p->em_cst = cst;
}
+void
EM_mkpro(p,opcode,pnam)
register p_instr p;
int opcode;
p->em_pnam = OO_freestr(pnam);
}
+void
EM_mkdefilb(p,opcode,deflb)
register p_instr p;
int opcode;
p->em_ilb = deflb;
}
+void
EM_Nop(opcode)
int opcode;
{
p->em_argtype = 0;
}
+void
EM_Nnarg(opcode)
int opcode;
{
p->em_cst = 0;
}
+void
EM_Nilb(opcode,lab)
int opcode;
label lab;
p->em_ilb = lab;
}
+void
EM_Nnof(opcode,lab,off)
int opcode;
label lab;
p->em_off = off;
}
+void
EM_Nsof(opcode,name,off)
int opcode;
char *name;
p->em_off = off;
}
+void
EM_Ncst(opcode,cst)
int opcode;
arith cst;
p->em_cst = cst;
}
+void
EM_Npro(opcode,pnam)
int opcode;
char *pnam;
p->em_pnam = OO_freestr(pnam);
}
+void
EM_Ndefilb(opcode,deflb)
int opcode;
label deflb;
p->em_ilb = deflb;
}
+void
EM_Rop(opcode)
int opcode;
{
p->em_argtype = 0;
}
+void
EM_Rnarg(opcode)
int opcode;
{
p->em_cst = 0;
}
+void
EM_Rilb(opcode,lab)
int opcode;
label lab;
p->em_ilb = lab;
}
+void
EM_Rnof(opcode,lab,off)
int opcode;
label lab;
p->em_off = off;
}
+void
EM_Rsof(opcode,name,off)
int opcode;
char *name;
p->em_off = off;
}
+void
EM_Rcst(opcode,cst)
int opcode;
arith cst;
p->em_cst = cst;
}
+void
EM_Rpro(opcode,pnam)
int opcode;
char *pnam;
p->em_pnam = OO_freestr(pnam);
}
+void
EM_Rdefilb(opcode,deflb)
int opcode;
label deflb;
**************************/
#define BTSCPY(pp,qq,i,p,q,n) for(pp=(p),qq=(q),i=(n);i--;*pp++ = *qq++)
+PRIVATE void allocmem();
+
+void
O_init(wsize,psize)
arith wsize, psize;
{
OO_PSIZE = psize;
}
+int
O_open(fname)
char *fname;
{
return(C_open(fname));
}
+void
O_magic()
{
C_magic();
}
+void
O_close()
{
C_close();
}
+void
OO_dfa(last)
register int last;
{
}
}
-PRIVATE
+PRIVATE void
fatal(s,a)
char *s;
int a;
sys_stop(S_EXIT);
}
-PRIVATE
+PRIVATE void
allocmem()
{
/* Allocate memory for queues on heap */
return(res);
}
+void
OO_flush()
{
/*
return (OO_nxtpatt++);
}
+void
OO_mkext(p,opcode,arg,off)
register p_instr p;
int opcode;
}
}
+void
OO_mkrepl(lrepl,diff,numbkup)
int lrepl,diff,numbkup;
{
}
#ifdef DEBUG
+void
dumpstate(mess)
char *mess;
{
fprintf(stderr,"\n");
}
+void
prtinst(p)
p_instr p;
{
#include <em_comp.h>
#include <system.h>
#include <emO_code.h>
+#include <ansi.h>
#define MAXBUFFER 200
#define MAXSTRING 1000
extern int OO_wrstats; /* statistics output */
#endif
-extern char *OO_freestr();
-extern arith OO_rotate();
-extern arith OO_offset();
-
#define CST(p) (p.em_cst)
#define PNAM(p) (p.em_pnam)
#define LAB(p) (p.em_ilb)
#define DEFILB(p) (p.em_ilb)
#define DEFINED(p) (p.em_argtype)
+_PROTOTYPE(void EM_mkop, (p_instr, int));
+_PROTOTYPE(void EM_mknarg, (p_instr, int));
+_PROTOTYPE(void EM_mkilb, (p_instr, int, label));
+_PROTOTYPE(void EM_mknof, (p_instr, int, label, arith));
+_PROTOTYPE(void EM_mksof, (p_instr, int, char *, arith));
+_PROTOTYPE(void EM_mkcst, (p_instr, int, arith));
+_PROTOTYPE(void EM_mkpro, (p_instr, int, char *));
+_PROTOTYPE(void EM_mkdefilb, (p_instr, int, label));
+_PROTOTYPE(void EM_Nop, (int));
+_PROTOTYPE(void EM_Nnarg, (int));
+_PROTOTYPE(void EM_Nilb, (int, label));
+_PROTOTYPE(void EM_Nnof, (int, label, arith));
+_PROTOTYPE(void EM_Nsof, (int, char *, arith));
+_PROTOTYPE(void EM_Ncst, (int, arith));
+_PROTOTYPE(void EM_Npro, (int, char *));
+_PROTOTYPE(void EM_Ndefilb, (int, label));
+_PROTOTYPE(void EM_Rop, (int));
+_PROTOTYPE(void EM_Rnarg, (int));
+_PROTOTYPE(void EM_Rilb, (int, label));
+_PROTOTYPE(void EM_Rnof, (int, label, arith));
+_PROTOTYPE(void EM_Rsof, (int, char *, arith));
+_PROTOTYPE(void EM_Rcst, (int, arith));
+_PROTOTYPE(void EM_Rpro, (int, char *));
+_PROTOTYPE(void EM_Rdefilb, (int, label));
+
+_PROTOTYPE(arith OO_rotate, (arith, arith));
+_PROTOTYPE(int OO_signsame, (arith, arith));
+_PROTOTYPE(int OO_sfit, (arith, arith));
+_PROTOTYPE(int OO_ufit, (arith, arith));
+_PROTOTYPE(int OO_extsame, (p_instr, p_instr));
+_PROTOTYPE(int OO_namsame, (p_instr, p_instr));
+_PROTOTYPE(arith OO_offset, (p_instr));
+
+_PROTOTYPE(char *OO_freestr, (char *));
+_PROTOTYPE(void OO_dfa, (int));
+_PROTOTYPE(void OO_flush, (void));
+_PROTOTYPE(p_instr OO_halfflush, (void));
+_PROTOTYPE(void OO_mkext, (p_instr, int, p_instr, arith));
+_PROTOTYPE(void OO_mkrepl, (int, int, int));
+
+#ifdef DEBUG
+_PROTOTYPE(void dumpstate, (char *));
+_PROTOTYPE(void prtinst, (p_instr));
+#endif
FILE *ofile;
+PRIVATE openofile();
+PRIVATE installofile();
+PRIVATE UNLINK();
+PRIVATE RENAME();
+PRIVATE outdfa();
+PRIVATE outmnems();
+PRIVATE outdotrans();
+PRIVATE outoneaction();
+PRIVATE outrepl();
+PRIVATE outexp();
+PRIVATE outext();
+PRIVATE outop();
+
outputnopt()
{
openofile("dfa.c");
.SUFFIXES: .d .r
-.r.d: ; CMD=$(CMD); export CMD; awk -f $(SRC_DIR)/makefuns.awk $*.r | sh -x
+.r.d: ; CMD=$(CMD); export CMD; awk -f $(SRC_DIR)/makefuns.awk prototypes=/dev/null $*.r | sh -x
touch $@
.SUFFIXES: .$(SUF)
dfa.c dfa.c.new trans.c trans.c.new\
incalls.d incalls.r incalls.r.new pseudo.d pseudo.r
-all: em_nopt $(LIBOPT) $(LIBCEOPT)
+all: em_nopt $(LIBOPT) $(LIBCEOPT) prototypes
install: all
+ -mkdir $(MOD_DIR)/lib
+ -mkdir $(MOD_DIR)/h
cp $(LIBOPT) $(MOD_DIR)/lib/$(LIBOPT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBOPT)
cp $(LIBCEOPT) $(MOD_DIR)/lib/$(LIBCEOPT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBCEOPT)
- cp $(SRC_DIR)/em_opt.3 $(MOD_DIR)/man/em_opt.3
cp em_nopt $(TARGET_HOME)/lib.bin/em_nopt
+ cp prototypes $(MOD_DIR)/h/em_codeO.h
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/em_opt.3 $(TARGET_HOME) ; \
mk_manpage $(SRC_DIR)/em_nopt.6 $(TARGET_HOME) ; \
-cmp $(LIBOPT) $(MOD_DIR)/lib/$(LIBOPT)
-cmp $(LIBCEOPT) $(MOD_DIR)/lib/$(LIBCEOPT)
-cmp em_nopt $(TARGET_HOME)/lib.bin/em_nopt
- -cmp $(SRC_DIR)/em_opt.3 $(MOD_DIR)/man/em_opt.3
+ -cmp prototypes $(MOD_DIR)/h/em_codeO.h
+
pr:
@pr $(SRCS)
clean:
rm -f O_*.$(SUF)
rm -f O_*.c
- rm -f $(NOFILES) main.$(SUF) $(POFILES)
+ rm -f $(NOFILES) main.$(SUF) $(POFILES) prototypes
rm -f $(GENFILES) parser em_nopt $(LIBOPT) $(LIBCEOPT)
# How to build stand alone version of the optimizer
-mv $(LIBOPT).saved $(LIBOPT)
rm -f O_*.$(SUF) $(NOFILES)
+prototypes: pseudo.r incalls.r
+ cp $(SRC_DIR)/em_codeO.h prototypes
+ echo >> prototypes
+ awk -f $(SRC_DIR)/makefuns.awk pseudo.r incalls.r > /dev/null
+
incalls.r: $(SRC_DIR)/patterns parser
-$(UTIL_HOME)/lib.bin/cpp $(SRC_DIR)/patterns | $(HOWMUCH) >/tmp/patts
parser </tmp/patts
/* $Header$ */
-# include "flt_misc.h"
+#include "flt_misc.h"
int
flt_b64_add(e1,e2)
#include "flt_misc.h"
-#if __STDC__ > 0
void
-#endif
flt_b64_sft(e,n)
register struct flt_mantissa *e;
register int n;
#include "flt_misc.h"
-#if __STDC__ > 0
void
-#endif
flt_add(e1,e2,e3)
register flt_arith *e1,*e2,*e3;
{
flt_chk(e3);
}
-#if __STDC__ > 0
void
-#endif
flt_sub(e1,e2,e3)
flt_arith *e1,*e2,*e3;
{
#include "flt_misc.h"
#include <em_arith.h>
-#if __STDC__ > 0
void
-#endif
flt_arith2flt(n, e, uns)
register arith n;
register flt_arith *e;
#define FLT_STRLEN 32
.PP
-.B flt_add(e1, e2, e3)
+.B void flt_add(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
-.B flt_mul(e1, e2, e3)
+.B void flt_mul(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
-.B flt_sub(e1, e2, e3)
+.B void flt_sub(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
-.B flt_div(e1, e2, e3)
+.B void flt_div(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
-.B flt_umin(e)
+.B void flt_umin(e)
.B flt_arith *e;
.PP
-.B flt_modf(e1, intpart, fractpart)
+.B void flt_modf(e1, intpart, fractpart)
.B flt_arith *e1, *intpart, *fractpart;
.PP
.B int flt_cmp(e1, e2)
.B flt_arith *e1, *e2;
.PP
-.B flt_str2flt(s, e)
+.B void flt_str2flt(s, e)
.B char *s;
.B flt_arith *e;
.PP
-.B flt_flt2str(e, buf, bufsize)
+.B void flt_flt2str(e, buf, bufsize)
.B flt_arith *e;
.B char *buf;
.B int bufsize;
.B int flt_status;
.PP
.B #include <em_arith.h>
-.B flt_arith2flt(n, e, uns)
+.B void flt_arith2flt(n, e, uns)
.B arith n;
.B flt_arith *e;
.B int uns;
.B flt_arith *e;
.B int uns;
.PP
-.B flt_b64_sft(m, n)
+.B void flt_b64_sft(m, n)
.B struct flt_mantissa *m;
.B int n;
.SH DESCRIPTION
#ifndef __FLT_INCLUDED__
#define __FLT_INCLUDED__
+#include "ansi.h"
+
#ifndef arith
#define arith long
#endif
#define FLT_STRLEN 32 /* max length of result of flt_flt2str() */
-#if __STDC__ > 0
-void flt_add(flt_arith *, flt_arith *, flt_arith *);
-void flt_sub(flt_arith *, flt_arith *, flt_arith *);
-void flt_mul(flt_arith *, flt_arith *, flt_arith *);
-void flt_div(flt_arith *, flt_arith *, flt_arith *);
-void flt_modf(flt_arith *, flt_arith *, flt_arith *);
-int flt_cmp(flt_arith *, flt_arith *);
-void flt_str2flt(char *, flt_arith *);
-void flt_flt2str(flt_arith *, char *, int);
-void flt_arith2flt(arith, flt_arith *, int);
-arith flt_flt2arith(flt_arith *, int);
-void flt_b64_sft(struct flt_mantissa *, int);
-void flt_umin(flt_arith *);
-#else
-arith flt_flt2arith();
-#endif
+_PROTOTYPE(void flt_add, (flt_arith *, flt_arith *, flt_arith *));
+_PROTOTYPE(void flt_sub, (flt_arith *, flt_arith *, flt_arith *));
+_PROTOTYPE(void flt_mul, (flt_arith *, flt_arith *, flt_arith *));
+_PROTOTYPE(void flt_div, (flt_arith *, flt_arith *, flt_arith *));
+_PROTOTYPE(void flt_modf, (flt_arith *, flt_arith *, flt_arith *));
+_PROTOTYPE(int flt_cmp, (flt_arith *, flt_arith *));
+_PROTOTYPE(void flt_str2flt, (char *, flt_arith *));
+_PROTOTYPE(void flt_flt2str, (flt_arith *, char *, int));
+_PROTOTYPE(void flt_arith2flt, (arith, flt_arith *, int));
+_PROTOTYPE(arith flt_flt2arith, (flt_arith *, int));
+_PROTOTYPE(void flt_b64_sft, (struct flt_mantissa *, int));
+_PROTOTYPE(void flt_umin, (flt_arith *));
+
#endif /* __FLT_INCLUDED__ */
#include "flt_misc.h"
int flt_status = 0;
-#if __STDC__ > 0
+
void
-#endif
flt_chk(e)
register flt_arith *e;
{
/* $Header$ */
-#include "flt_misc.h"
+#include "flt_misc.h"
int
flt_cmp(e1, e2)
/* $Header$ */
#include "flt_misc.h"
-#if __STDC__ > 0
+
void
-#endif
flt_div(e1,e2,e3)
register flt_arith *e1,*e2,*e3;
{
#define flt_b64_add _flt_64add
#define flt_split _flt_split
-#if __STDC__ > 0
-int ucmp(long, long);
-void flt_nrm(flt_arith *);
-void flt_chk(flt_arith *);
-int flt_b64_add(struct flt_mantissa *, struct flt_mantissa *);
-void flt_split(flt_arith *, unsigned short *);
-#endif
+_PROTOTYPE(int ucmp, (long, long));
+_PROTOTYPE(void flt_nrm, (flt_arith *));
+_PROTOTYPE(void flt_chk, (flt_arith *));
+_PROTOTYPE(int flt_b64_add, (struct flt_mantissa *, struct flt_mantissa *));
+_PROTOTYPE(void flt_split, (flt_arith *, unsigned short *));
/* $Header$ */
#include "flt_misc.h"
-#if __STDC__ > 0
+
void
-#endif
flt_modf(e, ipart, fpart)
register flt_arith *e, *ipart, *fpart;
{
/* $Header$ */
#include "flt_misc.h"
-#if __STDC__ > 0
+
void
-#endif
flt_mul(e1,e2,e3)
register flt_arith *e1,*e2,*e3;
{
/* $Header$ */
#include "flt_misc.h"
-#if __STDC__ > 0
+
void
-#endif
flt_nrm(e)
register flt_arith *e;
{
if (!status) status = flt_status;
flt_status = status;
}
-#if __STDC__ > 0
+
void
-#endif
flt_str2flt(s, e)
register char *s;
register flt_arith *e;
}
return buf;
}
-#if __STDC__ > 0
+
void
-#endif
flt_flt2str(e, buf, bufsize)
flt_arith *e;
char *buf;
/* $Header$ */
#include "flt_misc.h"
-#if __STDC__ > 0
+
void
-#endif
flt_umin(e)
flt_arith *e;
{
$(RANLIB) $(LIBFLT)
install: all
+ -mkdir $(MOD_DIR)/lib
+ -mkdir $(MOD_DIR)/h
cp $(LIBFLT) $(MOD_DIR)/lib/$(LIBFLT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBFLT)
cp $(SRC_DIR)/flt_arith.h $(MOD_DIR)/h/flt_arith.h
- cp $(SRC_DIR)/flt_arith.3 $(MOD_DIR)/man/flt_arith.3
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/flt_arith.3 $(TARGET_HOME) ; \
fi
cmp: all
-cmp $(LIBFLT) $(MOD_DIR)/lib/$(LIBFLT)
-cmp $(SRC_DIR)/flt_arith.h $(MOD_DIR)/h/flt_arith.h
- -cmp $(SRC_DIR)/flt_arith.3 $(MOD_DIR)/man/flt_arith.3
pr:
@pr $(SRC_DIR)/proto.make $(SRC)
/* $Header$ */
#include "flt_misc.h"
-#if __STDC__ > 0
+
void
-#endif
flt_split(e, p)
register flt_arith *e;
register unsigned short *p;
init_idf, str2idf, findidf\ \-\ a namelist module
.SH SYNOPSIS
.PP
-.B init_idf()
+.B void init_idf()
.PP
.B struct idf *str2idf(tag, cpy)
.br
(variable, selector, structure tag, etc.).
*/
-#if __STDC__
-static struct idf *IDF_new(char *, int, int);
-#endif
+_PROTOTYPE(static struct idf *IDF_new, (char *, int, int));
+
+void
+init_idf()
+{
+}
static struct idf *
IDF_new(tg, size, cpy)
}
#ifdef IDF_DEBUG
+void
hash_stat()
{
register int i;
print("End hash table tally\n");
}
+void
idfappfun(fun, opt)
int (*fun)();
int opt;
/* $Header$ */
/* IDENTIFIER DESCRIPTOR */
+#include <ansi.h>
+
/* This a generic package for maintaining a name list */
/* Instantiation parameters, supplied by #define, are :
/* init_idf()
- Initializes the namelist. Empty for now.
+ Initializes the namelist.
*/
-#define init_idf()
+_PROTOTYPE(void init_idf, (void));
/* struct idf * str2idf(tg, cp)
char *tg;
If cp < 0, the string is not entered, but only looked for.
*/
-#if __STDC__ > 0
-struct idf *str2idf(char *, int);
-#else
-extern struct idf * str2idf();
-#endif
+_PROTOTYPE(struct idf *str2idf, (char *, int));
#define findidf(tg) str2idf(tg, -1)
all:
install: all
+ -mkdir $(MOD_DIR)/pkg
cp $(SRC_DIR)/idf_pkg.body $(MOD_DIR)/pkg/idf_pkg.body
cp $(SRC_DIR)/idf_pkg.spec $(MOD_DIR)/pkg/idf_pkg.spec
- cp $(SRC_DIR)/idf.3 $(MOD_DIR)/man/idf.3
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/idf.3 $(TARGET_HOME) ; \
fi
cmp: all
-cmp $(SRC_DIR)/idf_pkg.body $(MOD_DIR)/pkg/idf_pkg.body
-cmp $(SRC_DIR)/idf_pkg.spec $(MOD_DIR)/pkg/idf_pkg.spec
- -cmp $(SRC_DIR)/idf.3 $(MOD_DIR)/man/idf.3
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/idf_pkg.spec $(SRC_DIR)/idf_pkg.body