declared freopen; apparently it is not declared in stdio.h
on some systems
This commit is contained in:
parent
dd320002c2
commit
cb16212a09
5 changed files with 25 additions and 10 deletions
|
@ -61,6 +61,7 @@ long con();
|
||||||
|
|
||||||
FILE *emfile;
|
FILE *emfile;
|
||||||
extern FILE *codefile;
|
extern FILE *codefile;
|
||||||
|
extern FILE *freopen();
|
||||||
|
|
||||||
int nextispseu,savetab1;
|
int nextispseu,savetab1;
|
||||||
int opcode;
|
int opcode;
|
||||||
|
|
|
@ -20,6 +20,7 @@ static char rcsid[] = "$Header$";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FILE *codefile;
|
FILE *codefile;
|
||||||
|
extern FILE *freopen();
|
||||||
|
|
||||||
out_init(filename) char *filename; {
|
out_init(filename) char *filename; {
|
||||||
|
|
||||||
|
|
|
@ -432,10 +432,13 @@ normalfailed: if (stackpad!=tokpatlen) {
|
||||||
myfree(besttup);
|
myfree(besttup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DO_TOSTACK:
|
||||||
case DO_REMOVE: {
|
case DO_REMOVE: {
|
||||||
int texpno,nodeno;
|
int texpno,nodeno;
|
||||||
token_p tp;
|
token_p tp;
|
||||||
struct reginfo *rp;
|
struct reginfo *rp;
|
||||||
|
int doremove = (codep[-1] & 037) == DO_REMOVE;
|
||||||
|
extern int allsetno;
|
||||||
|
|
||||||
DEBUG("REMOVE");
|
DEBUG("REMOVE");
|
||||||
if (codep[-1]&32) {
|
if (codep[-1]&32) {
|
||||||
|
@ -445,6 +448,13 @@ normalfailed: if (stackpad!=tokpatlen) {
|
||||||
getint(texpno,codep);
|
getint(texpno,codep);
|
||||||
nodeno=0;
|
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--)
|
for (tp= &fakestack[stackheight-tokpatlen-1];tp>=&fakestack[0];tp--)
|
||||||
if (match(tp,&machsets[texpno],nodeno)) {
|
if (match(tp,&machsets[texpno],nodeno)) {
|
||||||
/* investigate possible coercion to register */
|
/* investigate possible coercion to register */
|
||||||
|
@ -452,8 +462,9 @@ normalfailed: if (stackpad!=tokpatlen) {
|
||||||
CHKCOST();
|
CHKCOST();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (rp=machregs;rp<machregs+NREGS;rp++)
|
if (doremove) for (rp=machregs;rp<machregs+NREGS;rp++)
|
||||||
if (match(&rp->r_contents,&machsets[texpno],nodeno))
|
if (rp->r_contents.t_token != 0 &&
|
||||||
|
match(&rp->r_contents,&machsets[texpno],nodeno))
|
||||||
rp->r_contents.t_token=0;
|
rp->r_contents.t_token=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ long con();
|
||||||
|
|
||||||
FILE *emfile;
|
FILE *emfile;
|
||||||
extern FILE *codefile;
|
extern FILE *codefile;
|
||||||
|
extern FILE *freopen();
|
||||||
|
|
||||||
int nextispseu,savetab1;
|
int nextispseu,savetab1;
|
||||||
int opcode;
|
int opcode;
|
||||||
|
|
|
@ -22,6 +22,7 @@ static char rcsid[] = "$Header$";
|
||||||
string mystrcpy();
|
string mystrcpy();
|
||||||
|
|
||||||
FILE *codefile;
|
FILE *codefile;
|
||||||
|
extern FILE *freopen();
|
||||||
|
|
||||||
out_init(filename) char *filename; {
|
out_init(filename) char *filename; {
|
||||||
|
|
||||||
|
@ -88,20 +89,20 @@ praddr(ad) addr_t ad; {
|
||||||
if (ad.ea_str==0 || *(ad.ea_str) == '\0')
|
if (ad.ea_str==0 || *(ad.ea_str) == '\0')
|
||||||
fprintf(codefile,WRD_FMT,ad.ea_off);
|
fprintf(codefile,WRD_FMT,ad.ea_off);
|
||||||
else {
|
else {
|
||||||
fprintf(codefile,"%s",ad.ea_str);
|
fputs(ad.ea_str, codefile);
|
||||||
if (ad.ea_off<0) {
|
if (ad.ea_off<0) {
|
||||||
fputc('-', codefile);
|
putc('-', codefile);
|
||||||
fprintf(codefile,WRD_FMT,-ad.ea_off);
|
fprintf(codefile,WRD_FMT,-ad.ea_off);
|
||||||
}
|
}
|
||||||
else if(ad.ea_off>0) {
|
else if(ad.ea_off>0) {
|
||||||
fputc('+',codefile);
|
putc('+',codefile);
|
||||||
fprintf(codefile,WRD_FMT,ad.ea_off);
|
fprintf(codefile,WRD_FMT,ad.ea_off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gennl() {
|
gennl() {
|
||||||
fputc('\n',codefile);
|
putc('\n',codefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
prtoken(tp,leadingchar) token_p tp; {
|
prtoken(tp,leadingchar) token_p tp; {
|
||||||
|
@ -109,9 +110,9 @@ prtoken(tp,leadingchar) token_p tp; {
|
||||||
register char *code;
|
register char *code;
|
||||||
register tkdef_p tdp;
|
register tkdef_p tdp;
|
||||||
|
|
||||||
fputc(leadingchar,codefile);
|
putc(leadingchar,codefile);
|
||||||
if (tp->t_token == -1) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
tdp = &tokens[tp->t_token];
|
tdp = &tokens[tp->t_token];
|
||||||
|
@ -119,7 +120,7 @@ prtoken(tp,leadingchar) token_p tp; {
|
||||||
code = codestrings[tdp->t_format];
|
code = codestrings[tdp->t_format];
|
||||||
while ((c = *code++) != 0) {
|
while ((c = *code++) != 0) {
|
||||||
if (c>=' ' && c<='~')
|
if (c>=' ' && c<='~')
|
||||||
fputc(c,codefile);
|
putc(c,codefile);
|
||||||
else {
|
else {
|
||||||
assert(c>0 && c<=TOKENSIZE);
|
assert(c>0 && c<=TOKENSIZE);
|
||||||
switch(tdp->t_type[c-1]) {
|
switch(tdp->t_type[c-1]) {
|
||||||
|
@ -132,7 +133,7 @@ prtoken(tp,leadingchar) token_p tp; {
|
||||||
praddr(tp->t_att[c-1].aa);
|
praddr(tp->t_att[c-1].aa);
|
||||||
break;
|
break;
|
||||||
case EV_REG:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue