1987-03-09 15:15:03 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1984-11-27 22:11:59 +00:00
|
|
|
#include "bem.h"
|
1984-11-27 23:21:41 +00:00
|
|
|
#include <em_path.h>
|
1984-11-27 22:11:59 +00:00
|
|
|
|
1984-11-27 23:13:28 +00:00
|
|
|
#ifndef NORSCID
|
|
|
|
static char rcs_id[] = "$Header$" ;
|
|
|
|
#endif
|
|
|
|
|
1984-11-27 22:11:59 +00:00
|
|
|
/* generate temporary files etc */
|
|
|
|
|
|
|
|
FILE *emfile;
|
1987-03-02 09:06:26 +00:00
|
|
|
FILE *Tmpfile;
|
1984-11-27 22:11:59 +00:00
|
|
|
FILE *datfile;
|
|
|
|
|
|
|
|
initialize()
|
|
|
|
{
|
1985-01-25 11:04:18 +00:00
|
|
|
register char *cindex, *cptr ;
|
|
|
|
|
1984-11-27 23:21:41 +00:00
|
|
|
sprintf(tmpfname,"%s/abc%d",TMP_DIR,getpid());
|
1985-01-25 11:04:18 +00:00
|
|
|
/* Find the basename */
|
|
|
|
/* Strip leading directories */
|
|
|
|
cindex= (char *)0 ;
|
|
|
|
for ( cptr=program ; *cptr ; cptr++ ) if ( *cptr=='/' ) cindex=cptr ;
|
|
|
|
if ( !cindex ) cindex= program ;
|
|
|
|
else {
|
|
|
|
cindex++ ;
|
|
|
|
if ( !*cindex ) {
|
|
|
|
warning("Null program name, assuming \"basic\"") ;
|
|
|
|
cindex= "basic" ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cptr=datfname ;
|
|
|
|
while ( *cptr++ = *cindex++ ) ;
|
|
|
|
/* Strip trailing suffix */
|
|
|
|
if ( cptr>datfname+3 && cptr[-3]=='.' ) cptr[-3]=0 ;
|
1984-11-27 22:11:59 +00:00
|
|
|
strcat(datfname,".d");
|
|
|
|
yyin= fopen(inpfile,"r");
|
|
|
|
emfile= fopen(outfile,"w");
|
1987-03-02 09:06:26 +00:00
|
|
|
Tmpfile= fopen(tmpfname,"w");
|
|
|
|
if( yyin==NULL || emfile== NULL || Tmpfile== NULL )
|
1984-11-27 22:11:59 +00:00
|
|
|
fatal("Improper file permissions");
|
|
|
|
fillkex(); /* initialize symbol table */
|
|
|
|
fprintf(emfile,"#\n");
|
|
|
|
fprintf(emfile," mes 2,EM_WSIZE,EM_PSIZE\n");
|
|
|
|
initdeftype(); /* set default symbol declarers */
|
|
|
|
}
|