myfree(besttup);
break;
}
+ case DO_TOSTACK:
case DO_REMOVE: {
int texpno,nodeno;
token_p tp;
struct reginfo *rp;
+ int doremove = (codep[-1] & 037) == DO_REMOVE;
+ extern int allsetno;
DEBUG("REMOVE");
if (codep[-1]&32) {
getint(texpno,codep);
nodeno=0;
}
+ if (texpno == allsetno) {
+ totalcost += stackupto(&fakestack[stackheight-tokpatlen-1],ply,toplevel);
+ CHKCOST();
+ if (doremove) for (rp=machregs;rp<machregs+NREGS;rp++)
+ rp->r_contents.t_token=0;
+ break;
+ }
for (tp= &fakestack[stackheight-tokpatlen-1];tp>=&fakestack[0];tp--)
if (match(tp,&machsets[texpno],nodeno)) {
/* investigate possible coercion to register */
CHKCOST();
break;
}
- for (rp=machregs;rp<machregs+NREGS;rp++)
- if (match(&rp->r_contents,&machsets[texpno],nodeno))
+ if (doremove) for (rp=machregs;rp<machregs+NREGS;rp++)
+ if (rp->r_contents.t_token != 0 &&
+ match(&rp->r_contents,&machsets[texpno],nodeno))
rp->r_contents.t_token=0;
break;
}
string mystrcpy();
FILE *codefile;
+extern FILE *freopen();
out_init(filename) char *filename; {
if (ad.ea_str==0 || *(ad.ea_str) == '\0')
fprintf(codefile,WRD_FMT,ad.ea_off);
else {
- fprintf(codefile,"%s",ad.ea_str);
+ fputs(ad.ea_str, codefile);
if (ad.ea_off<0) {
- fputc('-', codefile);
+ putc('-', codefile);
fprintf(codefile,WRD_FMT,-ad.ea_off);
}
else if(ad.ea_off>0) {
- fputc('+',codefile);
+ putc('+',codefile);
fprintf(codefile,WRD_FMT,ad.ea_off);
}
}
}
gennl() {
- fputc('\n',codefile);
+ putc('\n',codefile);
}
prtoken(tp,leadingchar) token_p tp; {
register char *code;
register tkdef_p tdp;
- fputc(leadingchar,codefile);
+ putc(leadingchar,codefile);
if (tp->t_token == -1) {
- fprintf(codefile,"%s",codestrings[machregs[tp->t_att[0].ar].r_repr]);
+ fputs(codestrings[machregs[tp->t_att[0].ar].r_repr],codefile);
return;
}
tdp = &tokens[tp->t_token];
code = codestrings[tdp->t_format];
while ((c = *code++) != 0) {
if (c>=' ' && c<='~')
- fputc(c,codefile);
+ putc(c,codefile);
else {
assert(c>0 && c<=TOKENSIZE);
switch(tdp->t_type[c-1]) {
praddr(tp->t_att[c-1].aa);
break;
case EV_REG:
- fprintf(codefile,"%s",codestrings[machregs[tp->t_att[c-1].ar].r_repr]);
+ fputs(codestrings[machregs[tp->t_att[c-1].ar].r_repr],codefile);
break;
}
}