Pristine Ack-5.5
[Ack-5.5.git] / util / ncgg / error.c
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 #ifndef NORCSID
6 static char rcsid[]= "$Id: error.c,v 0.3 1994/06/24 10:37:11 ceriel Exp $";
7 #endif
8
9 #include <stdio.h>
10
11 int nerrors=0;
12
13 yyerror(s) char *s; {
14
15         error("Parser gives %s",s);
16 }
17
18 goodbye() {
19
20         error("This was fatal, goodbye!");
21 #ifndef NDEBUG
22         abort();
23 #endif
24 }
25
26 /*VARARGS1*/
27 fatal(s,a,b,c,d) char *s; {
28
29         error(s,a,b,c,d);
30         errorexit();
31         goodbye();
32         exit(-1);
33 }
34
35 /*VARARGS1*/
36 error(s,a,b,c,d) char *s; {
37         extern int lineno;
38         extern char *filename;
39
40         fprintf(stderr,"\"%s\", line %d:",filename,lineno);
41         fprintf(stderr,s,a,b,c,d);
42         fprintf(stderr,"\n");
43         nerrors++;
44 }
45
46 #ifndef NDEBUG
47 badassertion(string,file,line) char *string,*file; {
48
49         fprintf(stderr,"\"%s\", line %d: Assertion failed \"%s\"\n",
50                 file,line,string);
51         goodbye();
52 }
53 #endif
54
55 tabovf(string) char *string; {
56
57         fatal("%s overflow",string);
58 }