util.c 1.0 KB

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