Sun defines tmpfile in stdio.h. Renamed Tmpfile

This commit is contained in:
ceriel 1987-03-02 09:06:26 +00:00
parent 1e10c0cf98
commit f1fc51c85c
6 changed files with 50 additions and 50 deletions

View file

@ -36,7 +36,7 @@ extern char tmpfname[MAXFILENAME]; /* temporary statements file */
extern FILE *emfile; /* EM output file */
extern FILE *datfile; /* data file */
extern FILE *tmpfile; /* compiler temporary */
extern FILE *Tmpfile; /* compiler temporary */
extern FILE *yyin; /* Compiler input */
extern int endofinput;
@ -51,7 +51,7 @@ extern int threshold;
extern int debug;
extern int tronoff;
extern int emlinecount; /* counts lines on tmpfile */
extern int emlinecount; /* counts lines on Tmpfile */
extern int dataused;
extern int typetable[10]; /* parameters to standard functions */

View file

@ -136,9 +136,9 @@ char *opcode;
emcode(opcode,instrlabel(l1));
emcode("loc",itoa(0));
emcode("bra",instrlabel(l2));
fprintf(tmpfile,"%d\n",l1); emlinecount++;
fprintf(Tmpfile,"%d\n",l1); emlinecount++;
emcode("loc",itoa(-1));
fprintf(tmpfile,"%d\n",l2); emlinecount++;
fprintf(Tmpfile,"%d\n",l2); emlinecount++;
}
relop( ltype,rtype,operator)
int ltype,rtype,operator;
@ -292,10 +292,10 @@ loadptr(s)
Symbol *s;
{
if( POINTERSIZE==WORDSIZE)
fprintf(tmpfile," loe l%d\n",s->symalias);
fprintf(Tmpfile," loe l%d\n",s->symalias);
else
if( POINTERSIZE== 2*WORDSIZE)
fprintf(tmpfile," lde l%d\n",s->symalias);
fprintf(Tmpfile," lde l%d\n",s->symalias);
else error("loadptr:unexpected pointersize");
}
*/
@ -355,10 +355,10 @@ Symbol *s;
else{
j= -s->symalias;
if(debug) printf("load parm %d\n",j);
fprintf(tmpfile," lal ");
fprintf(Tmpfile," lal ");
for(i=fcn->dimensions;i>j;i--)
fprintf(tmpfile,"%s+",typesize(fcn->dimlimit[i-1]));
fprintf(tmpfile,"0\n");
fprintf(Tmpfile,"%s+",typesize(fcn->dimlimit[i-1]));
fprintf(Tmpfile,"0\n");
emlinecount++;
/*
emcode("lal",datalabel(fcn->dimalias[-s->symalias]));
@ -424,7 +424,7 @@ int type;
conversion(type,INTTYPE);
dim--;
/* first check index range */
fprintf(tmpfile," lae r%d\n",s->dimalias[dim]);
fprintf(Tmpfile," lae r%d\n",s->dimalias[dim]);
emlinecount++;
emcode("rck",EMINTSIZE);
emcode("lae",datalabel(s->dimalias[dim]));

View file

@ -36,23 +36,23 @@ int blk1,blk2;
{
/* exchange assembler blocks */
if(debug) printf("exchange %d %d %d\n",blk1,blk2,emlinecount);
fprintf(tmpfile," exc %d,%d\n",blk2-blk1,emlinecount-blk2);
fprintf(Tmpfile," exc %d,%d\n",blk2-blk1,emlinecount-blk2);
emlinecount++;
}
/* routines to manipulate the tmpfile */
/* routines to manipulate the Tmpfile */
int emlinecount; /* count number of lines generated */
/* this value can be used to generate EXC */
int tronoff=0;
newemblock(nr)
int nr;
{
/* save location on tmpfile */
currline->offset= ftell(tmpfile);
fprintf(tmpfile,"%d\n",currline->emlabel);
/* save location on Tmpfile */
currline->offset= ftell(Tmpfile);
fprintf(Tmpfile,"%d\n",currline->emlabel);
emlinecount++;
if (! nolins) {
fprintf(tmpfile," lin %d\n",nr);
fprintf(Tmpfile," lin %d\n",nr);
emlinecount++;
}
if( tronoff || traceflag) {
@ -65,7 +65,7 @@ int nr;
emcode(operation,params)
char *operation,*params;
{
fprintf(tmpfile," %s %s\n",operation,params);
fprintf(Tmpfile," %s %s\n",operation,params);
emlinecount++;
}
/* Handle data statements */
@ -304,13 +304,13 @@ int elselab;
nr=genlabel();
emcode("bra",instrlabel(nr));
fprintf(tmpfile,"%d\n",elselab);
fprintf(Tmpfile,"%d\n",elselab);
emlinecount++;
return(nr);
}
elsepart(lab)int lab;
{
fprintf(tmpfile,"%d\n",lab); emlinecount++;
fprintf(Tmpfile,"%d\n",lab); emlinecount++;
}
/* generate code for the for-statement */
#define MAXFORDEPTH 20
@ -425,7 +425,7 @@ int type;
emcode("sti",typestring(result));
emcode("bra",instrlabel(f->fortst));
/* increment loop variable */
fprintf(tmpfile,"%d\n",f->forinc);
fprintf(Tmpfile,"%d\n",f->forinc);
emlinecount++;
emcode("lae",datalabel(varaddress));
loadvar(result);
@ -437,7 +437,7 @@ int type;
emcode("lae",datalabel(varaddress));
emcode("sti",typestring(result));
/* test boundary */
fprintf(tmpfile,"%d\n",f->fortst);
fprintf(Tmpfile,"%d\n",f->fortst);
emlinecount++;
emcode("lae",datalabel(varaddress));
loadvar(result);
@ -457,7 +457,7 @@ Symbol *s;
else{
/* address of variable is on top of stack ! */
emcode("bra",instrlabel(fortable[forcnt].forinc));
fprintf(tmpfile,"%d\n",fortable[forcnt].forout);
fprintf(Tmpfile,"%d\n",fortable[forcnt].forout);
forcnt--;
}
}
@ -486,7 +486,7 @@ whilestart()
newblock(-1);
whilelabels[whilecnt][0]= currline->emlabel;
whilelabels[whilecnt][1]= genlabel();
fprintf(tmpfile,"%d\n", whilelabels[whilecnt][0]);
fprintf(Tmpfile,"%d\n", whilelabels[whilecnt][0]);
emlinecount++;
}
whiletst(exprtype)
@ -494,7 +494,7 @@ int exprtype;
{
/* test expression type */
conversion(exprtype,INTTYPE);
fprintf(tmpfile," zeq *%d\n",whilelabels[whilecnt][1]);
fprintf(Tmpfile," zeq *%d\n",whilelabels[whilecnt][1]);
emlinecount++;
}
wend()
@ -502,8 +502,8 @@ wend()
if( whilecnt<1)
error("not part of while statement");
else{
fprintf(tmpfile," bra *%d\n",whilelabels[whilecnt][0]);
fprintf(tmpfile,"%d\n",whilelabels[whilecnt][1]);
fprintf(Tmpfile," bra *%d\n",whilelabels[whilecnt][0]);
fprintf(Tmpfile,"%d\n",whilelabels[whilecnt][1]);
emlinecount++;
emlinecount++;
whilecnt--;

View file

@ -78,8 +78,8 @@ int nr;
/*NOSTRICT*/ l= (Linerecord *) salloc(sizeof(*l));
l->emlabel= frwrd? frwrd->emlabel: genlabel();
l->linenr= nr;
/* save offset into tmpfile too */
l->offset = (long) ftell(tmpfile);
/* save offset into Tmpfile too */
l->offset = (long) ftell(Tmpfile);
l->codelines= emlinecount;
/* insert this record */
@ -163,7 +163,7 @@ int lab;
emcode("cal","$_gosub"); /* administer legal return */
emcode("asp",EMINTSIZE);
emcode("bra",instrlabel(nr));
fprintf(tmpfile,"%d\n",l->emlabel);
fprintf(Tmpfile,"%d\n",l->emlabel);
emlinecount++;
}
genreturns()
@ -185,7 +185,7 @@ returnstmt()
{
emcode("cal","$_retstmt"); /* ensure legal return*/
emcode("lfr",EMINTSIZE);
fprintf(tmpfile," lae returns\n");
fprintf(Tmpfile," lae returns\n");
emlinecount++;
emcode("csa",EMINTSIZE);
}
@ -219,12 +219,12 @@ int type;
/* create descriptor first */
descr= genlabel();
firstlabel=genlabel();
fprintf(tmpfile,"l%d\n",descr); emlinecount++;
fprintf(tmpfile," rom *%d,1,%d\n",firstlabel,jumpcnt-1); emlinecount++;
fprintf(Tmpfile,"l%d\n",descr); emlinecount++;
fprintf(Tmpfile," rom *%d,1,%d\n",firstlabel,jumpcnt-1); emlinecount++;
l= jumphead;
while( l)
{
fprintf(tmpfile," rom *%d\n",l->emlabel); emlinecount++;
fprintf(Tmpfile," rom *%d\n",l->emlabel); emlinecount++;
l= l->nextlist;
}
jumphead= jumptail=0; jumpcnt=0;
@ -232,7 +232,7 @@ int type;
conversion(type,INTTYPE);
emcode("lae",datalabel(descr));
emcode("csa",EMINTSIZE);
fprintf(tmpfile,"%d\n",firstlabel); emlinecount++;
fprintf(Tmpfile,"%d\n",firstlabel); emlinecount++;
}
ongosubstmt(type)
int type;
@ -243,12 +243,12 @@ int type;
/* create descriptor first */
descr= genlabel();
firstlabel=genlabel();
fprintf(tmpfile,"l%d\n",descr); emlinecount++;
fprintf(tmpfile," rom *%d,1,%d\n",firstlabel,jumpcnt-1); emlinecount++;
fprintf(Tmpfile,"l%d\n",descr); emlinecount++;
fprintf(Tmpfile," rom *%d,1,%d\n",firstlabel,jumpcnt-1); emlinecount++;
l= jumphead;
while( l)
{
fprintf(tmpfile," rom *%d\n",l->emlabel); emlinecount++;
fprintf(Tmpfile," rom *%d\n",l->emlabel); emlinecount++;
l= l->nextlist;
}
jumphead= jumptail=0; jumpcnt=0;
@ -269,7 +269,7 @@ int type;
conversion(type,INTTYPE);
emcode("lae",datalabel(descr));
emcode("csa",EMINTSIZE);
fprintf(tmpfile,"%d\n",firstlabel);
fprintf(Tmpfile,"%d\n",firstlabel);
emlinecount++;
}
@ -283,11 +283,11 @@ simpleprogram()
/* a small EM programs has been found */
prologcode();
prolog2();
(void) fclose(tmpfile);
tmpfile= fopen(tmpfname,"r");
if( tmpfile==NULL)
(void) fclose(Tmpfile);
Tmpfile= fopen(tmpfname,"r");
if( Tmpfile==NULL)
fatal("tmp file disappeared");
while( (length=fread(buf,1,512,tmpfile)) != 0)
while( (length=fread(buf,1,512,Tmpfile)) != 0)
(void) fwrite(buf,1,length,emfile);
epilogcode();
(void) unlink(tmpfname);

View file

@ -8,7 +8,7 @@ static char rcs_id[] = "$Header$" ;
/* generate temporary files etc */
FILE *emfile;
FILE *tmpfile;
FILE *Tmpfile;
FILE *datfile;
initialize()
@ -35,8 +35,8 @@ initialize()
strcat(datfname,".d");
yyin= fopen(inpfile,"r");
emfile= fopen(outfile,"w");
tmpfile= fopen(tmpfname,"w");
if( yyin==NULL || emfile== NULL || tmpfile== NULL )
Tmpfile= fopen(tmpfname,"w");
if( yyin==NULL || emfile== NULL || Tmpfile== NULL )
fatal("Improper file permissions");
fillkex(); /* initialize symbol table */
fprintf(emfile,"#\n");

View file

@ -196,8 +196,8 @@ fcnsize()
/* generate portable function size */
int i;
for(i=0;i<fcn->dimensions;i++)
fprintf(tmpfile,"%s+",typesize(fcn->dimlimit[i]));
fprintf(tmpfile,"0\n"); emlinecount++;
fprintf(Tmpfile,"%s+",typesize(fcn->dimlimit[i]));
fprintf(Tmpfile,"0\n"); emlinecount++;
}
endscope(type)
int type;
@ -208,7 +208,7 @@ int type;
conversion(type,fcn->symtype);
emcode("ret", typestring(fcn->symtype));
/* generate portable EM code */
fprintf(tmpfile," end ");
fprintf(Tmpfile," end ");
fcnsize();
s= firstsym;
while(s)
@ -267,9 +267,9 @@ int parmcount;
error("not enough parameters");
if( parmcount >fcn->dimensions)
error("too many parameters");
fprintf(tmpfile," cal $_%s\n",fcn->symname);
fprintf(Tmpfile," cal $_%s\n",fcn->symname);
emlinecount++;
fprintf(tmpfile," asp ");
fprintf(Tmpfile," asp ");
fcnsize();
emcode("lfr",typestring(fcn->symtype));
type= fcn->symtype;