declared freopen; apparently it is not declared in stdio.h

on some systems
This commit is contained in:
ceriel 1987-09-01 15:24:15 +00:00
parent dd320002c2
commit cb16212a09
5 changed files with 25 additions and 10 deletions

View file

@ -61,6 +61,7 @@ long con();
FILE *emfile;
extern FILE *codefile;
extern FILE *freopen();
int nextispseu,savetab1;
int opcode;

View file

@ -20,6 +20,7 @@ static char rcsid[] = "$Header$";
*/
FILE *codefile;
extern FILE *freopen();
out_init(filename) char *filename; {

View file

@ -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;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 */
@ -452,8 +462,9 @@ normalfailed: if (stackpad!=tokpatlen) {
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;
}

View file

@ -61,6 +61,7 @@ long con();
FILE *emfile;
extern FILE *codefile;
extern FILE *freopen();
int nextispseu,savetab1;
int opcode;

View file

@ -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;
}
}