util.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef NORCSID
  2. static char rcsid[] = "$Header$";
  3. #endif
  4. #include <stdio.h>
  5. #include "param.h"
  6. #include "types.h"
  7. #include "shc.h"
  8. #include "assert.h"
  9. #include "lookup.h"
  10. #include "proinf.h"
  11. #include "optim.h"
  12. #include "ext.h"
  13. /*
  14. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  15. * See the copyright notice in the ACK home directory, in the file "Copyright".
  16. *
  17. * Author: Hans van Staveren
  18. */
  19. /* VARARGS1 */
  20. error(s,a) char *s,*a; {
  21. fprintf(stderr,"%s: error on line %u",progname,linecount);
  22. if (prodepth != 0)
  23. fprintf(stderr,"(%.*s)",IDL,curpro.symbol->s_name);
  24. fprintf(stderr,": ");
  25. fprintf(stderr,s,a);
  26. fprintf(stderr,"\n");
  27. abort();
  28. exit(-1);
  29. }
  30. #ifndef NDEBUG
  31. badassertion(file,line) char *file; unsigned line; {
  32. fprintf(stderr,"assertion failed file %s, line %u\n",file,line);
  33. error("assertion");
  34. }
  35. #endif
  36. #ifdef DIAGOPT
  37. optim(n) {
  38. fprintf(stderr,"Made optimization %d",n);
  39. if (prodepth)
  40. fprintf(stderr," (%.*s)",IDL,curpro.symbol->s_name);
  41. fprintf(stderr,"\n");
  42. }
  43. #endif