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;
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 */
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;
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");
}
*/
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]));
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]));
{
/* 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) {
emcode(operation,params)
char *operation,*params;
{
- fprintf(tmpfile," %s %s\n",operation,params);
+ fprintf(Tmpfile," %s %s\n",operation,params);
emlinecount++;
}
/* Handle data statements */
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
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);
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);
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--;
}
}
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)
{
/* test expression type */
conversion(exprtype,INTTYPE);
- fprintf(tmpfile," zeq *%d\n",whilelabels[whilecnt][1]);
+ fprintf(Tmpfile," zeq *%d\n",whilelabels[whilecnt][1]);
emlinecount++;
}
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--;
/*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 */
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()
{
emcode("cal","$_retstmt"); /* ensure legal return*/
emcode("lfr",EMINTSIZE);
- fprintf(tmpfile," lae returns\n");
+ fprintf(Tmpfile," lae returns\n");
emlinecount++;
emcode("csa",EMINTSIZE);
}
/* 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;
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;
/* 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;
conversion(type,INTTYPE);
emcode("lae",datalabel(descr));
emcode("csa",EMINTSIZE);
- fprintf(tmpfile,"%d\n",firstlabel);
+ fprintf(Tmpfile,"%d\n",firstlabel);
emlinecount++;
}
/* 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);
/* generate temporary files etc */
FILE *emfile;
-FILE *tmpfile;
+FILE *Tmpfile;
FILE *datfile;
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");
/* 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;
conversion(type,fcn->symtype);
emcode("ret", typestring(fcn->symtype));
/* generate portable EM code */
- fprintf(tmpfile," end ");
+ fprintf(Tmpfile," end ");
fcnsize();
s= firstsym;
while(s)
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;