Pristine Ack-5.5
[Ack-5.5.git] / util / opt / util.c
1 #ifndef NORCSID
2 static char rcsid[] = "$Id: util.c,v 2.7 1994/06/24 10:41:15 ceriel Exp $";
3 #endif
4
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 /*
16  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
17  * See the copyright notice in the ACK home directory, in the file "Copyright".
18  *
19  * Author: Hans van Staveren
20  */
21
22
23 /* VARARGS1 */
24 error(s,a) char *s,*a; {
25
26         fprintf(stderr,"%s: error on line %u",progname,linecount);
27         if (prodepth != 0)
28                 fprintf(stderr,"(%.*s)",IDL,curpro.symbol->s_name);
29         fprintf(stderr,": ");
30         fprintf(stderr,s,a);
31         fprintf(stderr,"\n");
32 #ifndef NDEBUG
33         abort();
34 #endif
35         exit(-1);
36 }
37
38 #ifndef NDEBUG
39 badassertion(file,line) char *file; unsigned line; {
40
41         fprintf(stderr,"assertion failed file %s, line %u\n",file,line);
42         error("assertion");
43 }
44 #endif
45
46 #ifdef DIAGOPT
47 optim(n) {
48
49         fprintf(stderr,"Made optimization %d",n);
50         if (prodepth)
51                 fprintf(stderr," (%.*s)",IDL,curpro.symbol->s_name);
52         fprintf(stderr,"\n");
53 }
54 #endif