ack/lang/basic/src/initialize.c

52 lines
1.2 KiB
C
Raw Normal View History

1988-07-04 11:45:41 +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".
*/
#include <stdio.h>
1988-07-04 11:45:41 +00:00
#include "bem.h"
#include "util.h"
1988-07-04 11:45:41 +00:00
#ifndef NORCSID
1994-06-24 11:31:16 +00:00
static char rcs_id[] = "$Id$";
1988-07-04 11:45:41 +00:00
#endif
/* generate temporary files etc */
File *datfile;
extern void fillkex(void);
1988-07-04 11:45:41 +00:00
void initialize(void)
1988-07-04 11:45:41 +00:00
{
register char *cindex, *cptr;
int result1, result2;
1988-07-04 11:45:41 +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++) !=0 );
1988-07-04 11:45:41 +00:00
/* Strip trailing suffix */
if ( cptr>datfname+3 && cptr[-3]=='.' ) cptr[-3]=0;
strcat(datfname,".d");
C_init((arith)BEMINTSIZE, (arith)BEMPTRSIZE);
result1 = sys_open(inpfile, OP_READ, &yyin);
result2 = C_open(outfile);
1988-07-06 18:18:46 +00:00
if ( result1==0 || result2== 0 )
1988-07-04 11:45:41 +00:00
fatal("Improper file permissions");
1988-07-05 18:27:10 +00:00
C_magic();
1988-07-04 11:45:41 +00:00
fillkex(); /* initialize symbol table */
C_ms_emx((arith)BEMINTSIZE,(arith)BEMPTRSIZE);
initdeftype(); /* set default symbol declarers */
}