From: ceriel Date: Tue, 1 Sep 1987 15:24:15 +0000 (+0000) Subject: declared freopen; apparently it is not declared in stdio.h X-Git-Tag: release-5-5~3856 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=cb16212a09daf40afd3d4c1ca1c75cdc7f1b1e82;p=ack.git declared freopen; apparently it is not declared in stdio.h on some systems --- diff --git a/mach/proto/cg/fillem.c b/mach/proto/cg/fillem.c index 4d1c63377..58a25c00e 100644 --- a/mach/proto/cg/fillem.c +++ b/mach/proto/cg/fillem.c @@ -61,6 +61,7 @@ long con(); FILE *emfile; extern FILE *codefile; +extern FILE *freopen(); int nextispseu,savetab1; int opcode; diff --git a/mach/proto/cg/gencode.c b/mach/proto/cg/gencode.c index 2f5758b90..ee08d43f4 100644 --- a/mach/proto/cg/gencode.c +++ b/mach/proto/cg/gencode.c @@ -20,6 +20,7 @@ static char rcsid[] = "$Header$"; */ FILE *codefile; +extern FILE *freopen(); out_init(filename) char *filename; { diff --git a/mach/proto/ncg/codegen.c b/mach/proto/ncg/codegen.c index 02336d48e..b281153aa 100644 --- a/mach/proto/ncg/codegen.c +++ b/mach/proto/ncg/codegen.c @@ -432,10 +432,13 @@ normalfailed: if (stackpad!=tokpatlen) { 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) { @@ -445,6 +448,13 @@ normalfailed: if (stackpad!=tokpatlen) { getint(texpno,codep); nodeno=0; } + if (texpno == allsetno) { + totalcost += stackupto(&fakestack[stackheight-tokpatlen-1],ply,toplevel); + CHKCOST(); + if (doremove) for (rp=machregs;rpr_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 */ @@ -452,8 +462,9 @@ normalfailed: if (stackpad!=tokpatlen) { CHKCOST(); break; } - for (rp=machregs;rpr_contents,&machsets[texpno],nodeno)) + if (doremove) for (rp=machregs;rpr_contents.t_token != 0 && + match(&rp->r_contents,&machsets[texpno],nodeno)) rp->r_contents.t_token=0; break; } diff --git a/mach/proto/ncg/fillem.c b/mach/proto/ncg/fillem.c index e9fc59e6e..a785f739e 100644 --- a/mach/proto/ncg/fillem.c +++ b/mach/proto/ncg/fillem.c @@ -61,6 +61,7 @@ long con(); FILE *emfile; extern FILE *codefile; +extern FILE *freopen(); int nextispseu,savetab1; int opcode; diff --git a/mach/proto/ncg/gencode.c b/mach/proto/ncg/gencode.c index a5e70719e..c103c8844 100644 --- a/mach/proto/ncg/gencode.c +++ b/mach/proto/ncg/gencode.c @@ -22,6 +22,7 @@ static char rcsid[] = "$Header$"; string mystrcpy(); FILE *codefile; +extern FILE *freopen(); out_init(filename) char *filename; { @@ -88,20 +89,20 @@ praddr(ad) addr_t ad; { 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; { @@ -109,9 +110,9 @@ 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]; @@ -119,7 +120,7 @@ prtoken(tp,leadingchar) token_p tp; { 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]) { @@ -132,7 +133,7 @@ prtoken(tp,leadingchar) token_p tp; { 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; } }