initialize.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #include "bem.h"
  6. #ifndef NORSCID
  7. static char rcs_id[] = "$Id$";
  8. #endif
  9. /* generate temporary files etc */
  10. File *datfile;
  11. initialize()
  12. {
  13. register char *cindex, *cptr;
  14. int result1, result2;
  15. /* Find the basename */
  16. /* Strip leading directories */
  17. cindex= (char *)0;
  18. for ( cptr=program; *cptr; cptr++ ) if ( *cptr=='/' ) cindex=cptr;
  19. if ( !cindex ) cindex= program;
  20. else {
  21. cindex++;
  22. if ( !*cindex ) {
  23. warning("Null program name, assuming \"basic\"");
  24. cindex= "basic";
  25. }
  26. }
  27. cptr=datfname;
  28. while ( *cptr++ = *cindex++ );
  29. /* Strip trailing suffix */
  30. if ( cptr>datfname+3 && cptr[-3]=='.' ) cptr[-3]=0;
  31. strcat(datfname,".d");
  32. C_init((arith)BEMINTSIZE, (arith)BEMPTRSIZE);
  33. result1 = sys_open(inpfile, OP_READ, &yyin);
  34. result2 = C_open(outfile);
  35. if ( result1==0 || result2== 0 )
  36. fatal("Improper file permissions");
  37. C_magic();
  38. fillkex(); /* initialize symbol table */
  39. C_ms_emx((arith)BEMINTSIZE,(arith)BEMPTRSIZE);
  40. initdeftype(); /* set default symbol declarers */
  41. }